Export (0) Print
Expand All

ActiveX Controls: Optimization

Visual Studio 6.0

http://msdn.microsoft.com/en-us/library/aa241093(v=vs.60).aspxOverviewHow Do IFAQhttp://msdn.microsoft.com/en-us/library/aa716401(v=vs.60).aspxSample

This article explains techniques you can use to optimize your ActiveX controls for better performance.

What do you want to know more about?

The topics Turning Off the Activate When Visible Option and Providing Mouse Interaction While Inactive discuss controls that don’t create a window until activated. The topic Providing Windowless Activation discusses controls that never create a window, even when they are activated.

Windows have two major drawbacks for OLE objects: they prevent objects from being transparent or nonrectangular when active, and they add a large overhead to the instantiation and display of controls. Typically, creating a window takes 60 percent of a control’s creation time. With a single shared window (usually the container’s) and some dispatching code, a control receives the same window services, generally without a loss of performance. Having a window is mostly unnecessary overhead for the object.

Some optimizations do not necessarily improve performance when your control is used in certain containers. For example, containers released prior to 1996 did not support windowless activation, so implementing this feature will not provide a benefit in older containers. However, nearly every container supports persistence, so optimizing your control’s persistence code will likely improve its performance in any container. If your control is specifically intended to be used with one particular type of container, you may want to research which of these optimizations is supported by that container. In general, however, you should try to implement as many of these techniques as are applicable to your particular control to ensure your control performs as well as it possibly can in a wide array of containers.

You can implement many of these optimizations through ControlWizard.

ControlWizard OLE Optimization Options

ControlWizard Option Action More Information
Activate when visible checkbox on ControlWizard Step 2 of 2 Clear Turning Off the Activate When Visible Option
Windowless activation checkbox on ControlWizard Advanced ActiveX Features Select Providing Windowless Activation
Unclipped device context Select Using an Unclipped Device Context
Flicker-free activation checkbox on ControlWizard Advanced ActiveX Features Select Providing Flicker-Free Activation
Mouse pointer notifications when inactive checkbox on ControlWizard Advanced ActiveX Features Select Providing Mouse Interaction While Inactive
Optimized drawing code checkbox on ControlWizard Advanced ActiveX Features Select Optimizing Control Drawing

For detailed information about the member functions that implement these optimizations, see . The member functions are listed by use, such as and .

Show:
© 2014 Microsoft