/** public functions **/ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) { hInstance = hinstDLL; if ( !controlsInit ) { controlsInit = TRUE; initClassDescArray(); // jaguar controls InitCustomControls(hInstance); // initialize Chicago controls InitCommonControls(); // register SXP readers RegisterSXPReader(_T("MARBLE_I.SXP"), Class_ID(MARBLE_CLASS_ID,0)); RegisterSXPReader(_T("NOISE_I.SXP"), Class_ID(NOISE_CLASS_ID,0)); RegisterSXPReader(_T("NOISE2_I.SXP"), Class_ID(NOISE_CLASS_ID,0)); } switch(fdwReason) { case DLL_PROCESS_ATTACH: break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; case DLL_PROCESS_DETACH: break; } return(TRUE); }
BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) { hInstance = hinstDLL; if ( !controlsInit ) { controlsInit = TRUE; // jaguar controls InitCustomControls(hInstance); // initialize Chicago controls InitCommonControls(); } switch(fdwReason) { case DLL_PROCESS_ATTACH: //MessageBox(NULL,_T("3DSIMP.DLL: DllMain"),_T("3DSIMP"),MB_OK); if (FAILED(CoInitialize(NULL))) return FALSE; break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; case DLL_PROCESS_DETACH: break; } return(TRUE); }
/** public functions **/ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) { hInstance = hinstDLL; hResource = hinstDLL; if ( !controlsInit ) { controlsInit = TRUE; // initialize Chicago controls InitCommonControls(); InitCustomControls (hResource); } switch(fdwReason) { case DLL_PROCESS_ATTACH: break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; case DLL_PROCESS_DETACH: break; } return(TRUE); }
/** public functions **/ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) { hInstance = hinstDLL; if ( !controlsInit ) { controlsInit = TRUE; initClassDescArray(); // jaguar controls InitCustomControls(hInstance); #ifdef OLD3DCONTROLS // initialize 3D controls Ctl3dRegister(hinstDLL); Ctl3dAutoSubclass(hinstDLL); #endif // initialize Chicago controls InitCommonControls(); } switch(fdwReason) { case DLL_PROCESS_ATTACH: break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; case DLL_PROCESS_DETACH: break; } return(TRUE); }
/** public functions **/ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) { hInstance = hinstDLL; if ( !controlsInit ) { controlsInit = TRUE; // jaguar controls InitCustomControls(hInstance); // initialize Chicago controls InitCommonControls(); // register SXP readers RegisterSXPReader(_T("PLANET_I.SXP"), Class_ID(PLANET_CLASS_ID,0)); RegisterSXPReader(_T("STUCCO_I.SXP"), Class_ID(STUCCO_CLASS_ID,0)); RegisterSXPReader(_T("SMOKE_I.SXP"), Class_ID(SMOKE_CLASS_ID,0)); RegisterSXPReader(_T("SPECKL_I.SXP"), Class_ID(SPECKLE_CLASS_ID,0)); RegisterSXPReader(_T("SPLAT_I.SXP"), Class_ID(SPLAT_CLASS_ID,0)); #ifndef NO_MAPTYPE_WATER RegisterSXPReader(_T("WATER_I.SXP"), Class_ID(WATER_CLASS_ID,0)); #endif } switch(fdwReason) { case DLL_PROCESS_ATTACH: break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; case DLL_PROCESS_DETACH: break; } return(TRUE); }
/** public functions **/ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) { hInstance = hinstDLL; if ( !controlsInit ) { controlsInit = TRUE; InitCustomControls(hInstance); InitCommonControls(); } return(TRUE); }
BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) { hInstance = hinstDLL; // Hang on to this DLL's instance handle. if (!controlsInit) { controlsInit = TRUE; InitCustomControls(hInstance); // Initialize MAX's custom controls InitCommonControls(); // Initialize Win95 controls } return (TRUE); }
BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) { hInstance = hinstDLL; // Initialize the custom controls. This should be done only once. if (!controlsInit) { controlsInit = TRUE; InitCustomControls(hInstance); InitCommonControls(); } return (TRUE); }
BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) { hInstance = hinstDLL; // Hang on to this DLL's instance handle. if (!controlsInit) { controlsInit = TRUE; InitCustomControls(hInstance); // Initialize MAX's custom controls InitCommonControls(); // Initialize Win95 controls } // CAL-9/17/2002: set default bool control to boolean controller SetDefaultBoolController(GetBoolCntrlDesc()); return (TRUE); }
BOOL CMaxExporterApp::InitInstance() { static bool bInitialized = false; // initialize controls once if(!bInitialized) { DisableThreadLibraryCalls(m_hInstance); InitCustomControls(m_hInstance); InitCommonControls(); bInitialized = true; } return TRUE; }
BOOL MyDll::InitInstance() { CWinApp::InitInstance(); /* code from old DllMain, DLL_PROCESS_ATTACH. For hInst use theDll.m_hInstance */ InitCustomControls(m_hInstance); InitCommonControls(); if (FAILED(CoInitialize(NULL))) return FALSE; ghInstance = m_hInstance; return TRUE; }
BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) { // initialize nel context if (!NLMISC::INelContext::isContextInitialised()) new NLMISC::CApplicationContext(); hInstance = hinstDLL; // Hang on to this DLL's instance handle. if (!controlsInit) { controlsInit = TRUE; InitCustomControls(hInstance); // Initialize MAX's custom controls InitCommonControls(); // Initialize Win95 controls } return (TRUE); }
// global functions BOOL WINAPI DllMain(HINSTANCE hinstDLL, ULONG fdwReason, LPVOID lpvReserved) { // remember this dll's instance handle hInstance = hinstDLL; switch (fdwReason) { case DLL_PROCESS_ATTACH: // initialize max controls InitCustomControls(hInstance); // initialize microsoft controls InitCommonControls(); break; } return (TRUE); }
//// OUR DLL MODULE'S ENTRY FUNCTION ///////////////////////////////////// BOOL APIENTRY DllMain( HANDLE hModule,DWORD dwReason,LPVOID lpvResearved ) { hInstance = (HINSTANCE)hModule; // Initialize the custom controls // and this must be done only once if( !controlsInit ) { controlsInit = TRUE; InitCustomControls( hInstance ); InitCommonControls(); } return TRUE; }
BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) { hInstance = hinstDLL; // Hang on to this DLL's instance handle. if (!controlsInit) { controlsInit = TRUE; #if VERSION_3DSMAX < (14000<<16) // Version 14 (2012) InitCustomControls(hInstance); // Initialize MAX's custom controls #endif InitCommonControls(); // Initialize Win95 controls RegisterNotification(DoNotifyNodeHide, nullptr, NOTIFY_NODE_HIDE); RegisterNotification(DoNotifyNodeUnHide, nullptr, NOTIFY_NODE_UNHIDE); } if (fdwReason == DLL_PROCESS_ATTACH) InitializeLibSettings(); return (TRUE); }
BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) { switch (fdwReason) { case DLL_PROCESS_ATTACH: hInstance = hinstDLL; InitCustomControls(hInstance); InitCommonControls(); break; case DLL_PROCESS_DETACH: break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; } return (TRUE); }
/** public functions **/ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) { i4_win32_instance=my_instance = hInstance = hinstDLL; i4_win32_nCmdShow=0; i4_win32_window_handle=0; if (!controlsInit) { controlsInit = TRUE; // jaguar controls InitCustomControls(hInstance); // initialize Chicago controls InitCommonControls(); } return (TRUE); }
BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) { hInstance = hinstDLL; // Hang on to this DLL's instance handle. if (!controlsInit) { controlsInit = TRUE; InitCustomControls(hInstance); // Initialize MAX's custom controls InitCommonControls(); // Initialize Win95 controls } if(fdwReason == DLL_PROCESS_ATTACH) { DisableThreadLibraryCalls(hinstDLL); InitXT(); } else if(fdwReason == DLL_PROCESS_DETACH) TerminateXT(); return (TRUE); }
BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) { // initialize nel context if (!NLMISC::INelContext::isContextInitialised()) { new NLMISC::CLibraryContext(GetSharedNelContext()); nldebug("NeL Vertex Tree Paint: DllMain"); } hInstance = hinstDLL; // Hang on to this DLL's instance handle. switch (fdwReason) { case DLL_PROCESS_ATTACH: InitCustomControls(hInstance); // Initialize MAX's custom controls InitCommonControls(); // Initialize Win95 controls break; } return (TRUE); }
BOOL WINAPI DllMain(HINSTANCE hInstDLL, ULONG fdwReason, LPVOID lpvReserved) { // Store the DLL's hInstance g_hInstance = hInstDLL; // Make sure we only initialize our common controls once if (!g_bControlsInitialized) { // We initialized our common controls g_bControlsInitialized = true; // Initialize Max's custom controls InitCustomControls(g_hInstance); // Initialize Win95 controls InitCommonControls(); } // Everything went well return (TRUE); }
BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) { #if MAX_VERSION_MAJOR < 9 //Max 9 hInstance = hinstDLL; // Hang on to this DLL's instance handle. static BOOL controlsInit = FALSE; if (!controlsInit) { controlsInit = TRUE; InitCustomControls(hInstance); // Initialize MAX's custom controls InitCommonControls(); // Initialize Win95 controls } #else if (fdwReason == DLL_PROCESS_ATTACH) { hInstance = hinstDLL; DisableThreadLibraryCalls(hInstance); } #endif return(TRUE); }
// ------------------------------------------------------------- BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) { hInstance = hinstDLL; // Hang on to this DLL's instance handle. if (!controlsInit) { controlsInit = TRUE; // Initialize Max's custom controls // jaguar controls InitCustomControls(hInstance); #ifdef OLD3DCONTROLS // initialize 3D controls Ctl3dRegister(hinstDLL); Ctl3dAutoSubclass(hinstDLL); #endif InitCommonControls(); } return TRUE; }
BOOL APIENTRY DllMain( HINSTANCE instance, DWORD reason, void* /*reserved*/ ) { s_classDescMySceneExport.instance = instance; if ( !s_controlsInit ) { s_controlsInit = true; InitCustomControls( instance ); InitCommonControls(); } switch ( reason ) { case DLL_PROCESS_ATTACH: case DLL_THREAD_ATTACH: case DLL_THREAD_DETACH: case DLL_PROCESS_DETACH: break; } return TRUE; }
BOOL WINAPI DllMain(HINSTANCE hDLLInst, DWORD fdwReason, LPVOID lpvReserved) { switch (fdwReason) { case DLL_PROCESS_ATTACH: if (hInst) return(FALSE); hInst = hDLLInst; if ( !controlsInit ) { controlsInit = TRUE; InitCustomControls(hInst); //InitCommonControls(); } break; case DLL_PROCESS_DETACH: hInst = NULL; break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; } return TRUE; }
BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) { hInstance = hinstDLL; if ( !controlsInit ) { controlsInit = TRUE; // jaguar controls InitCustomControls(hInstance); InitCommonControls(); } switch(fdwReason) { case DLL_PROCESS_ATTACH: //MessageBox(NULL,_T("AIEXP.DLL: DllMain"),_T("AIEXP"),MB_OK); break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; case DLL_PROCESS_DETACH: break; } return(TRUE); }
BOOL APIENTRY DllMain( HINSTANCE hModule, DWORD ul_reason_for_call, LPVOID lpReserved ) { static BOOL controlsInit = FALSE; switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: // Hang on to this DLL's instance handle. PFActions::hInstance = hModule; if ( !controlsInit ) { controlsInit = TRUE; // MAX custom controls InitCustomControls(PFActions::hInstance); // Initialize Win95 controls InitCommonControls(); } break; } return(TRUE); }
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) { MSG uMsg; memset(&uMsg,0,sizeof(uMsg)); winClass.lpszClassName = "MY_WINDOWS_CLASS"; winClass.cbSize = sizeof(WNDCLASSEX); winClass.style = CS_HREDRAW | CS_VREDRAW; winClass.lpfnWndProc = WndProc; winClass.hInstance = hInstance; winClass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1)); winClass.hIconSm = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1)); winClass.hCursor = LoadCursor(NULL, IDC_ARROW); winClass.lpszMenuName = MAKEINTRESOURCE(IDC_CV); winClass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); winClass.cbClsExtra = 0; winClass.cbWndExtra = 0; if( !RegisterClassEx(&winClass) ) return E_FAIL; GetINIPath(); OpenConsoleWindow = GetPrivateProfileBool("Display", "OpenConsoleWindow", true, IniName); if (OpenConsoleWindow) OpenConsole(); pcejin.aspectRatio = GetPrivateProfileBool("Video", "aspectratio", false, IniName); pcejin.windowSize = GetPrivateProfileInt("Video", "pcejin.windowSize", 1, IniName); WndX = GetPrivateProfileInt("Main", "WndX", 0, IniName); WndY = GetPrivateProfileInt("Main", "WndY", 0, IniName); g_hWnd = CreateWindowEx( NULL, "MY_WINDOWS_CLASS", pcejin.versionName.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE, WndX, WndY, 348, 224, NULL, NULL, hInstance, NULL ); if( g_hWnd == NULL ) return E_FAIL; ScaleScreen((float)pcejin.windowSize); soundInit(); LoadIniSettings(); InitSpeedThrottle(); DirectDrawInit(); InitCustomControls(); InitCustomKeys(&CustomKeys); LoadHotkeyConfig(); LoadInputConfig(); DragAcceptFiles(g_hWnd, true); extern void Agg_init(); Agg_init(); if (osd) {delete osd; osd =NULL; } osd = new OSDCLASS(-1); di_init(); DWORD wmTimerRes; TIMECAPS tc; if (timeGetDevCaps(&tc, sizeof(TIMECAPS))== TIMERR_NOERROR) { wmTimerRes = std::min(std::max(tc.wPeriodMin, (UINT)1), tc.wPeriodMax); timeBeginPeriod (wmTimerRes); } else { wmTimerRes = 5; timeBeginPeriod (wmTimerRes); } if (KeyInDelayMSec == 0) { DWORD dwKeyboardDelay; SystemParametersInfo(SPI_GETKEYBOARDDELAY, 0, &dwKeyboardDelay, 0); KeyInDelayMSec = 250 * (dwKeyboardDelay + 1); } if (KeyInRepeatMSec == 0) { DWORD dwKeyboardSpeed; SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &dwKeyboardSpeed, 0); KeyInRepeatMSec = (int)(1000.0/(((30.0-2.5)/31.0)*dwKeyboardSpeed+2.5)); } if (KeyInRepeatMSec < (int)wmTimerRes) KeyInRepeatMSec = (int)wmTimerRes; if (KeyInDelayMSec < KeyInRepeatMSec) KeyInDelayMSec = KeyInRepeatMSec; hKeyInputTimer = timeSetEvent (KeyInRepeatMSec, 0, KeyInputTimer, 0, TIME_PERIODIC); ShowWindow( g_hWnd, nCmdShow ); UpdateWindow( g_hWnd ); initialize(); if (lpCmdLine[0])ParseCmdLine(lpCmdLine, g_hWnd); while( uMsg.message != WM_QUIT ) { if( PeekMessage( &uMsg, NULL, 0, 0, PM_REMOVE ) ) { TranslateMessage( &uMsg ); DispatchMessage( &uMsg ); } else { emulate(); render(); } if(!pcejin.started) Sleep(1); } // shutDown(); timeEndPeriod (wmTimerRes); CloseAllToolWindows(); UnregisterClass( "MY_WINDOWS_CLASS", winClass.hInstance ); return uMsg.wParam; }
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow ) { MSG uMsg; memset(&uMsg,0,sizeof(uMsg)); winClass.lpszClassName = "MY_WINDOWS_CLASS"; winClass.cbSize = sizeof(WNDCLASSEX); winClass.style = CS_HREDRAW | CS_VREDRAW; winClass.lpfnWndProc = WndProc; winClass.hInstance = hInstance; winClass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1)); winClass.hIconSm = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON1)); winClass.hCursor = LoadCursor(NULL, IDC_ARROW); winClass.lpszMenuName = MAKEINTRESOURCE(IDC_CV); winClass.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); winClass.cbClsExtra = 0; winClass.cbWndExtra = 0; OpenConsole(); if( !RegisterClassEx(&winClass) ) return E_FAIL; GetINIPath(); LoadSettings(); pcejin.aspectRatio = GetPrivateProfileInt("Video", "aspectratio", 0, IniName); pcejin.windowSize = GetPrivateProfileInt("Video", "pcejin.windowSize", 1, IniName); WndX = GetPrivateProfileInt("Main", "WndX", 0, IniName); WndY = GetPrivateProfileInt("Main", "WndY", 0, IniName); g_hWnd = CreateWindowEx( NULL, "MY_WINDOWS_CLASS", pcejin.versionName.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE, WndX, WndY, 256, 232, NULL, NULL, hInstance, NULL ); if( g_hWnd == NULL ) return E_FAIL; ScaleScreen(pcejin.windowSize); soundInit(); LoadIniSettings(); InitSpeedThrottle(); RecentROMs.SetGUI_hWnd(g_hWnd); RecentROMs.SetID(RECENTROM_START); RecentROMs.SetMenuID(ID_FILE_RECENTROM); RecentROMs.SetType("ROM"); RecentROMs.MakeRecentMenu(hInstance); RecentROMs.GetRecentItemsFromIni(IniName, "General"); RecentMovies.SetGUI_hWnd(g_hWnd); RecentMovies.SetID(RECENTMOVIE_START); RecentMovies.SetMenuID(ID_MOVIE_RECENT); RecentMovies.SetType("Movie"); RecentMovies.MakeRecentMenu(hInstance); RecentMovies.GetRecentItemsFromIni(IniName, "General"); RecentLua.SetGUI_hWnd(g_hWnd); RecentLua.SetID(RECENTLUA_START); RecentLua.SetMenuID(ID_LUA_RECENT); RecentLua.SetType("Lua"); RecentLua.MakeRecentMenu(hInstance); RecentLua.GetRecentItemsFromIni(IniName, "General"); DirectDrawInit(); InitCustomControls(); InitCustomKeys(&CustomKeys); LoadHotkeyConfig(); LoadInputConfig(); DragAcceptFiles(g_hWnd, true); extern void Agg_init(); Agg_init(); if (osd) {delete osd; osd =NULL; } osd = new OSDCLASS(-1); di_init(); DWORD wmTimerRes; TIMECAPS tc; if (timeGetDevCaps(&tc, sizeof(TIMECAPS))== TIMERR_NOERROR) { wmTimerRes = std::min(std::max(tc.wPeriodMin, (UINT)1), tc.wPeriodMax); timeBeginPeriod (wmTimerRes); } else { wmTimerRes = 5; timeBeginPeriod (wmTimerRes); } if (KeyInDelayMSec == 0) { DWORD dwKeyboardDelay; SystemParametersInfo(SPI_GETKEYBOARDDELAY, 0, &dwKeyboardDelay, 0); KeyInDelayMSec = 250 * (dwKeyboardDelay + 1); } if (KeyInRepeatMSec == 0) { DWORD dwKeyboardSpeed; SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, &dwKeyboardSpeed, 0); KeyInRepeatMSec = (int)(1000.0/(((30.0-2.5)/31.0)*dwKeyboardSpeed+2.5)); } if (KeyInRepeatMSec < (int)wmTimerRes) KeyInRepeatMSec = (int)wmTimerRes; if (KeyInDelayMSec < KeyInRepeatMSec) KeyInDelayMSec = KeyInRepeatMSec; hKeyInputTimer = timeSetEvent (KeyInRepeatMSec, 0, KeyInputTimer, 0, TIME_PERIODIC); ShowWindow( g_hWnd, nCmdShow ); UpdateWindow( g_hWnd ); initialize(); if (lpCmdLine[0])ParseCmdLine(lpCmdLine, g_hWnd); if (RecentROMs.GetAutoLoad() && (!skipAutoLoadROM)) { ALoad(RecentROMs.GetRecentItem(0).c_str()); } //Intentionally does not prompt for a game if no game specified, user should be forced to autoload roms as well, for this to work properly if (RecentMovies.GetAutoLoad() && (!skipAutoLoadMovie)) { LoadMovie(RecentMovies.GetRecentItem(0).c_str(), 1, false, false); } if (RecentLua.GetAutoLoad() && (!skipAutoLoadLua)) { char temp [1024]; strcpy(temp, RecentLua.GetRecentItem(0).c_str()); HWND hDlg = CreateDialog(g_hInstance, MAKEINTRESOURCE(IDD_LUA), g_hWnd, (DLGPROC) LuaScriptProc); SendDlgItemMessage(hDlg,IDC_EDIT_LUAPATH,WM_SETTEXT,0,(LPARAM)temp); } while( uMsg.message != WM_QUIT ) { if( PeekMessage( &uMsg, NULL, 0, 0, PM_REMOVE ) ) { TranslateMessage( &uMsg ); DispatchMessage( &uMsg ); } else { emulate(); render(); } if(!pcejin.started) Sleep(1); } // shutDown(); timeEndPeriod (wmTimerRes); CloseAllToolWindows(); UnregisterClass( "MY_WINDOWS_CLASS", winClass.hInstance ); return uMsg.wParam; }
/** public functions **/ BOOL WINAPI DllMain(HINSTANCE hinstDLL,ULONG fdwReason,LPVOID lpvReserved) { hInstance = hinstDLL; if ( !controlsInit ) { controlsInit = TRUE; // initialize Chicago controls InitCommonControls(); } // If we have already tried to load the resource // file and failed just give up. if (triedToLoad && ! resourcesLoaded) return FALSE; // Load our resources. We look for the file in the // same directory where this DLL was found if (! resourcesLoaded) { // Where this DLL resides char dirName[MAX_PATH_LENGTH]; // Full path name to resource DLL char dllName[MAX_PATH_LENGTH]; char *chPtr; GetModuleFileName (hinstDLL, dirName, MAX_PATH_LENGTH); // Strip off the file name chPtr = dirName + strlen (dirName); while (*(--chPtr) != '\\') ; *(chPtr+1) = 0; // Add in "epsres.dll" strcpy (dllName, dirName); strcat (dllName, "pursuit.str"); // Load resource DLL // Turn off error reporting int errorMode = SetErrorMode(SEM_NOOPENFILEERRORBOX); hResource = LoadLibraryEx(dllName, NULL, 0); SetErrorMode(errorMode); // Be sure to check to see if we succeeded // loading resource DLL if (hResource) { resourcesLoaded = TRUE; InitCustomControls (hResource); } else { triedToLoad = TRUE; MessageBox (NULL,"Crowd Pursuit Behavior Plugin failed to load due to missing resource file pursuit.str", "CROWD", MB_ICONINFORMATION); return FALSE; } } switch(fdwReason) { case DLL_PROCESS_ATTACH: break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; case DLL_PROCESS_DETACH: if (hResource) { FreeLibrary(hResource); hResource = NULL; } break; } return(TRUE); }