Article ID: 116026
Article Last Modified on 11/21/2006
//
// FILE - DLLMAIN.CPP
//
#include <afxwin.h>
extern "C" int APIENTRY
DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
// Initialize DLL's instance(/module) not the app's
if (!AfxWinInit(hInstance, NULL, "", 0))
{
AfxWinTerm();
return 0; // Init Failed
}
// initialize the single instance DLL
if (!AfxGetApp()->InitInstance())
{
if(AfxGetApp()!=NULL)
AfxGetApp()->ExitInstance();
AfxWinTerm();
return 0; // Init Failed
}
}
else if (dwReason == DLL_PROCESS_DETACH)
{
if(AfxGetApp()!=NULL)
AfxGetApp()->ExitInstance();
// Terminate the library before destructors are called
AfxWinTerm();
}
return 1; // ok
}
//
// EOF - DLLMAIN.CPP
//
Additional query words: 1.00 2.00 2.10
Keywords: kbbug kbdll kbfix kbvc200fix KB116026