Export (0) Print
Expand All
Expand Minimize
This topic has not yet been rated - Rate this topic


Locks the class factory of the specified control so that dynamically created data associated with the control remains in memory.

BOOL AFXAPI AfxOleLockControl(
   REFCLSID clsid 
BOOL AFXAPI AfxOleLockControl(
   LPCTSTR lpszProgID 

The unique class ID of the control.


The unique program ID of the control.

Nonzero if the class factory of the control was successfully locked; otherwise 0.

This can significantly speed up display of the controls. For example, once you create a control in a dialog box and lock the control with AfxOleLockControl, you do not need to create and kill it again every time the dialog is shown or destroyed. If the user opens and closes a dialog box repeatedly, locking your controls can significantly enhance performance. When you are ready to destroy the control, call AfxOleUnlockControl.

// Starts and locks control's (Microsoft Calendar) class factory. 
// Control will remain in memory for lifetime of
// application or until AfxOleUnlockControl() is called.


Header: <afxwin.h>

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

© 2014 Microsoft. All rights reserved.