void AFXAPI AfxOleLockApp( );
#include <afxdisp.h>
Remarks
Increments the framework’s global count of the number of active objects in the application.
The framework keeps a count of the number of objects active in an application. The AfxOleLockApp and AfxOleUnlockApp functions, respectively, increment and decrement this count.
When the user attempts to close an application that has active objects — an application for which the count of active objects is nonzero — the framework hides the application from the user’s view instead of completely shutting it down. The AfxOleCanExitApp function indicates whether the application can terminate.
Call AfxOleLockApp from any object that exposes OLE interfaces, if it would be undesirable for that object to be destroyed while still being used by a client application. Also call AfxOleUnlockApp in the destructor of any object that calls AfxOleLockApp in the constructor. By default, COleDocument (and derived classes) automatically lock and unlock the application.
See Also AfxOleUnlockApp, AfxOleCanExitApp, COleDocument