AfxGetInstanceHandle
Visual Studio .NET 2003
This function allows you to retrieve the instance handle of the current application.
HINSTANCE AFXAPI AfxGetInstanceHandle( );
Return Value
An HINSTANCE to the current instance of the application. If called from within a DLL linked with the USRDLL version of MFC, an HINSTANCE to the DLL is returned.
Remarks
AfxGetInstanceHandle always returns the HINSTANCE of your executable file (.EXE) unless it is called from within a DLL linked with the USRDLL version of MFC. In this case, it returns an HINSTANCE to the DLL.
Example
// Print the application instance handle to the debugger output window.
TRACE("Application instance handle is 0x%0X\n", AfxGetInstanceHandle());
See Also
MFC Macros and Globals | AfxGetResourceHandle | AfxSetResourceHandle