void wxApp::CleanUp() { // all objects pending for deletion must be deleted first, otherwise we // would crash when they use wxWinHandleHash (and UnregisterWindowClasses() // call wouldn't succeed as long as any windows still exist), so call the // base class method first and only then do our clean up wxAppBase::CleanUp(); // for an EXE the classes are unregistered when it terminates but DLL may // be loaded several times (load/unload/load) into the same process in // which case the registration will fail after the first time if we don't // unregister the classes now UnregisterWindowClasses(); wxDELETE(wxWinHandleHash); }
void wxApp::CleanUp() { // all objects pending for deletion must be deleted first, otherwise // UnregisterWindowClasses() call wouldn't succeed (because windows // using the classes being unregistered still exist), so call the base // class method first and only then do our clean up wxAppBase::CleanUp(); wxSetKeyboardHook(false); wxOleUninitialize(); // for an EXE the classes are unregistered when it terminates but DLL may // be loaded several times (load/unload/load) into the same process in // which case the registration will fail after the first time if we don't // unregister the classes now UnregisterWindowClasses(); }
int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdParam, int nCmdShow) { MSG msg; WINDOWPLACEMENT w; BOOL bQuit = FALSE; InitCommonControls(); hInst = hInstance; // Find location of configuration file ConfigInit(); /* Register our custom classes */ RegisterWindowClasses(); hMain = CreateWindow(szAppName, /* window class name */ szAppName, /* window caption */ WS_OVERLAPPEDWINDOW, /* window style */ 0, 0, 0, 0, /* initially zero size; changed below */ NULL, /* parent window handle */ NULL, /* window menu handle */ hInstance, /* program instance handle */ NULL); /* creation parameters */ if (!hMain) { char buf[256]; DWORD err = GetLastError(); sprintf(buf, "Error - Couldn't Create Client Window : %d", err); MessageBox(NULL, buf, "ERROR!", MB_OK); MainQuit(hMain); exit(1); } if (config.debug) CreateDebugWindow(); if (lpszCmdParam && strlen(lpszCmdParam) > 0) ConfigOverride(lpszCmdParam); w.length = sizeof(WINDOWPLACEMENT); WindowSettingsLoad(&w); SetWindowPlacement(hMain, &w); D3DRenderInit(hMain); ModulesInit(); // Set up data structures for modules /* attempt make a crc16 on the meridian.exe */ GenerateCRC16(); MainInitState(STATE_OFFLINE); UpdateWindow(hMain); while (!bQuit) { MainIdle(); while (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { if (!GetMessage(&msg, NULL, 0, 0)) { bQuit = TRUE; break; } // Forward appropriate messages for tooltips if (state == STATE_GAME) TooltipForwardMessage(&msg); /* Handle modeless dialog messages separately */ if ((hCurrentDlg == NULL || !IsDialogMessage(hCurrentDlg, &msg))) { TranslateMessage(&msg); DispatchMessage(&msg); } } } /* Unregister our custom classes--not good to leave them around */ UnregisterWindowClasses(); return msg.wParam; // Return value of PostQuitMessage }