static void vigs_gl_backend_wgl_destroy(struct vigs_backend *backend) { struct vigs_gl_backend_wgl *gl_backend_wgl = (struct vigs_gl_backend_wgl*)backend; vigs_gl_backend_cleanup(&gl_backend_wgl->base); gl_backend_wgl->wglDeleteContext(gl_backend_wgl->ctx); gl_backend_wgl->wglDeleteContext(gl_backend_wgl->read_pixels_ctx); gl_backend_wgl->wglReleasePbufferDCARB(gl_backend_wgl->sfc, gl_backend_wgl->sfc_dc); gl_backend_wgl->wglDestroyPbufferARB(gl_backend_wgl->sfc); gl_backend_wgl->wglReleasePbufferDCARB(gl_backend_wgl->read_pixels_sfc, gl_backend_wgl->read_pixels_sfc_dc); gl_backend_wgl->wglDestroyPbufferARB(gl_backend_wgl->read_pixels_sfc); ReleaseDC(gl_backend_wgl->win, gl_backend_wgl->dc); DestroyWindow(gl_backend_wgl->win); FreeLibrary(gl_backend_wgl->handle); vigs_backend_cleanup(&gl_backend_wgl->base.base); g_free(gl_backend_wgl); UnregisterClassA((LPCTSTR)VIGS_WGL_WIN_CLASS, NULL); VIGS_LOG_DEBUG("destroyed"); }
static BOOL wined3d_dll_destroy(HINSTANCE hInstDLL) { DWORD wined3d_context_tls_idx = context_get_tls_idx(); unsigned int i; if (!TlsFree(wined3d_context_tls_idx)) { DWORD err = GetLastError(); ERR("Failed to free context TLS index, err %#x.\n", err); } for (i = 0; i < wndproc_table.count; ++i) { struct wined3d_wndproc *entry = &wndproc_table.entries[i]; SetWindowLongPtrW(entry->window, GWLP_WNDPROC, (LONG_PTR)entry->proc); } HeapFree(GetProcessHeap(), 0, wndproc_table.entries); HeapFree(GetProcessHeap(), 0, wined3d_settings.logo); UnregisterClassA(WINED3D_OPENGL_WINDOW_CLASS_NAME, hInstDLL); wined3d_mutex_term(); return TRUE; }
//////////////////////////////////////////////////////////// /// Close (destroy) the window. //////////////////////////////////////////////////////////// void WindowClose() { // Destroy the custom icon, if any if (WindowIcon) DestroyIcon(WindowIcon); if (!WindowCallback) { // Destroy the window if (WindowhWnd) DestroyWindow(WindowhWnd); // Unregister window class if we were the last window if (HasUnicodeSupport()) { UnregisterClassW(WindowClassNameW, GetModuleHandle(NULL)); } else { UnregisterClassA(WindowClassNameA, GetModuleHandle(NULL)); } } else { // The window is external : remove the hook on its message callback SetWindowLongPtr(WindowhWnd, GWLP_WNDPROC, WindowCallback); } // Set window open state to false WindowIsOpened = false; // Destroy the event mutex MutexDestroy(&WindowEventMutex); }
static HWND winraw_create_window(WNDPROC wnd_proc) { HWND wnd; WNDCLASSA wc = {0}; wc.hInstance = GetModuleHandleA(NULL); if (!wc.hInstance) { RARCH_ERR("[WINRAW]: GetModuleHandleA failed with error %lu.\n", GetLastError()); return NULL; } wc.lpfnWndProc = wnd_proc; wc.lpszClassName = "winraw-input"; if (!RegisterClassA(&wc) && GetLastError() != ERROR_CLASS_ALREADY_EXISTS) { RARCH_ERR("[WINRAW]: RegisterClassA failed with error %lu.\n", GetLastError()); return NULL; } wnd = CreateWindowExA(0, wc.lpszClassName, NULL, 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, NULL, NULL); if (!wnd) { RARCH_ERR("[WINRAW]: CreateWindowExA failed with error %lu.\n", GetLastError()); goto error; } return wnd; error: UnregisterClassA(wc.lpszClassName, NULL); return NULL; }
/** * Schliesst das Fenster. * * @author FloSoft */ void VideoWinAPI::DestroyScreen(void) { // Fenster schliessen EndDialog(screen, 0); if(dm_prev.dmBitsPerPel != 0) ChangeDisplaySettings(&dm_prev, CDS_RESET); if(screen_rc) { if(!wglMakeCurrent(NULL, NULL)) return; if(!wglDeleteContext(screen_rc)) return; screen_rc = NULL; } if((screen_dc) && (!ReleaseDC(screen, screen_dc))) return; screen_dc = NULL; if((screen) && (!DestroyWindow(screen))) return; screen = NULL; UnregisterClassA(GetWindowTitle(), GetModuleHandle(NULL)); isFullscreen_ = false; }
GLvoid KillGLWindow(GLvoid) // Properly Kill The Window { if (hRC) // Do We Have A Rendering Context? { if (!wglMakeCurrent(NULL,NULL)) // Are We Able To Release The DC And RC Contexts? { MessageBoxA(NULL,"Release Of DC And RC Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); } if (!wglDeleteContext(hRC)) // Are We Able To Delete The RC? { MessageBoxA(NULL,"Release Rendering Context Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); } hRC=NULL; // Set RC To NULL } if (hDC && !ReleaseDC(hWnd,hDC)) // Are We Able To Release The DC { MessageBoxA(NULL,"Release Device Context Failed.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); hDC=NULL; // Set DC To NULL } if (hWnd && !DestroyWindow(hWnd)) // Are We Able To Destroy The Window? { MessageBoxA(NULL,"Could Not Release hWnd.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); hWnd=NULL; // Set hWnd To NULL } if (!UnregisterClassA("OpenGL",hInstance)) // Are We Able To Unregister Class { MessageBoxA(NULL,"Could Not Unregister Class.","SHUTDOWN ERROR",MB_OK | MB_ICONINFORMATION); hInstance=NULL; // Set hInstance To NULL } }
void WIN32Window::terminate() { SetCursor(NULL); if(m_defaultCursor) { DestroyCursor(m_defaultCursor); m_defaultCursor = NULL; } for(HCURSOR& cursor : m_cursors) DestroyCursor(cursor); m_cursors.clear(); internalDestroyGLContext(); if(m_deviceContext) { if(!ReleaseDC(m_window, m_deviceContext)) g_logger.error("Release device context failed."); m_deviceContext = NULL; } if(m_window) { if(!DestroyWindow(m_window)) g_logger.error("ERROR: Destroy window failed."); m_window = NULL; } if(m_instance) { if(!UnregisterClassA(g_app.getCompactName().c_str(), m_instance)) g_logger.error("UnregisterClassA failed"); m_instance = NULL; } }
static void scrollbar_test_init(void) { WNDCLASSEXA wc; CHAR cls_name[] = "scroll_test_class"; LONG style[] = {WS_VSCROLL, WS_HSCROLL, WS_VSCROLL | WS_HSCROLL, 0}; int i; memset( &wc, 0, sizeof wc ); wc.cbSize = sizeof wc; wc.style = CS_VREDRAW | CS_HREDRAW; wc.hInstance = GetModuleHandleA(0); wc.hCursor = LoadCursorA(NULL, (LPCSTR)IDC_ARROW); wc.hbrBackground = GetStockObject(WHITE_BRUSH); wc.lpszClassName = cls_name; wc.lpfnWndProc = scroll_init_proc; RegisterClassExA(&wc); for(i = 0; i < sizeof style / sizeof style[0]; i++) { /* need not to destroy these windows due creation abort */ CreateWindowExA(0, cls_name, NULL, style[i], 100, 100, 100, 100, NULL, NULL, wc.hInstance, (LPVOID)TRUE); CreateWindowExA(0, cls_name, NULL, style[i], 100, 100, 100, 100, NULL, NULL, wc.hInstance, (LPVOID)FALSE); } UnregisterClassA(cls_name, wc.hInstance); }
static void test_messages(void) { WNDCLASSA cls; HWND win; MSG msg; HANDLE thread; DWORD tid; InitializeCriticalSection(&clipboard_cs); memset(&cls, 0, sizeof(cls)); cls.lpfnWndProc = clipboard_wnd_proc; cls.hInstance = GetModuleHandleA(NULL); cls.lpszClassName = "clipboard_test"; RegisterClassA(&cls); win = CreateWindowA("clipboard_test", NULL, 0, 0, 0, 0, 0, NULL, 0, NULL, 0); ok(win != NULL, "CreateWindow failed: %d\n", GetLastError()); thread = CreateThread(NULL, 0, clipboard_thread, (void*)win, 0, &tid); ok(thread != NULL, "CreateThread failed: %d\n", GetLastError()); while(GetMessageA(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessageA(&msg); } ok(WaitForSingleObject(thread, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n"); CloseHandle(thread); UnregisterClassA("clipboard_test", GetModuleHandleA(NULL)); DeleteCriticalSection(&clipboard_cs); }
void PlatformTerminate() { RestoreVideoSettings(); UnregisterClassA(kApplicationClassName, g_window.instance); DestroyIcon(g_window.icon); }
static BOOL wined3d_dll_destroy(HINSTANCE hInstDLL) { DWORD wined3d_context_tls_idx = context_get_tls_idx(); unsigned int i; if (!TlsFree(wined3d_context_tls_idx)) { DWORD err = GetLastError(); ERR("Failed to free context TLS index, err %#x.\n", err); } for (i = 0; i < wndproc_table.count; ++i) { /* Trying to unregister these would be futile. These entries can only * exist if either we skipped them in wined3d_unregister_window() due * to the application replacing the wndproc after the entry was * registered, or if the application still has an active wined3d * device. In the latter case the application has bigger problems than * these entries. */ WARN("Leftover wndproc table entry %p.\n", &wndproc_table.entries[i]); } HeapFree(GetProcessHeap(), 0, wndproc_table.entries); HeapFree(GetProcessHeap(), 0, wined3d_settings.logo); UnregisterClassA(WINED3D_OPENGL_WINDOW_CLASS_NAME, hInstDLL); DeleteCriticalSection(&wined3d_wndproc_cs); DeleteCriticalSection(&wined3d_cs); return TRUE; }
//--------------------------------------------------------------------------------- bool ContextBaseWin32::selfDestroy(){ if (mHRC){ // Si tenemos un contexto de renderizado if (!wglMakeCurrent(NULL, NULL)){ // Comprobamos si podemos librerar el Device context y el render context. MessageBoxA(NULL, "Release Of DC And RC Failed.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION); } if (!wglDeleteContext(mHRC)){ // Podemos eliminar el render context? MessageBoxA(NULL, "Release Rendering Context Failed.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION); } mHRC = NULL; // Set RC To NULL } // Intentamos liberar ahora el device context if (mHDC && !ReleaseDC(mHWnd, mHDC)){ // Podemos liberar el device context? MessageBoxA(NULL, "Release Device Context Failed.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION); mHDC = NULL; // Set DC To NULL } // Ahora toca cerrar la ventana if (mHWnd && !DestroyWindow(mHWnd)){ // Are We Able To Destroy The Window? MessageBoxA(NULL, "Could Not Release hWnd.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION); mHWnd = NULL; // Set hWnd To NULL } // Por ultimo hay que "desregistar" la clase de ventana y asi podremos borrar adecuadamente la misma para poder reabrirla más tarde. if (!UnregisterClassA("OpenGL", mHInstance)){ // Are We Able To Unregister Class MessageBoxA(NULL, "Could Not Unregister Class.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION); mHInstance = NULL; // Set hInstance To NULL } return true; }
/* Unregisters the window class. */ static BOOL RICHED32_Unregister(void) { TRACE("\n"); UnregisterClassA(RICHEDIT_CLASS10A, NULL); return TRUE; }
void KGWin32App::ExitClass() { if (m_szClass[0] != '\0' && m_hInstance) { UnregisterClassA(m_szClass, m_hInstance); m_szClass[0] = '\0'; } }
unsigned int run() { MSG msg; WNDCLASSA wc; HWND hwnd; wc.lpszClassName = DUMMY_WINDOW_CLASS; wc.lpfnWndProc = DummyWndProc; wc.style = CS_HREDRAW | CS_VREDRAW; wc.hInstance = g.hInstance; wc.hIcon = NULL; wc.hCursor = NULL; wc.hbrBackground = (HBRUSH)GetStockObject(BLACK_BRUSH); wc.lpszMenuName = NULL; wc.cbClsExtra = 0; wc.cbWndExtra = 0; if(!RegisterClassA(&wc)) return -1; hwnd = CreateWindowExA(0, DUMMY_WINDOW_CLASS, DUMMY_WINDOW_CLASS, 0, 0, 0, 32, 32, NULL, NULL, g.hInstance, NULL); if(!hwnd) { UnregisterClassA(DUMMY_WINDOW_CLASS, g.hInstance); return -2; } g.hwndDummy = hwnd; while(GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } g.hwndDummy = NULL; UnregisterClassA(DUMMY_WINDOW_CLASS, g.hInstance); return 0; }
boolean Window::init( int width, int height, const char* title, boolean fullscreen ) { HINSTANCE instance = GetModuleHandle( 0 ); WNDCLASSA wc; wc.style = 0; wc.lpfnWndProc = (WNDPROC)wndproc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = instance; wc.hIcon = LoadIcon( 0, IDI_APPLICATION ); wc.hCursor = LoadCursor( 0, IDC_ARROW ); wc.hbrBackground = (HBRUSH)GetStockObject( WHITE_BRUSH ); wc.lpszMenuName = 0; wc.lpszClassName = title; RegisterClassA( &wc ); DWORD style = fullscreen ? WS_POPUP : WS_OVERLAPPEDWINDOW; //style &= WS_MAXIMIZEBOX; RECT rct; rct.left = 0; rct.right = width; rct.top = 0; rct.bottom = height; AdjustWindowRect( &rct, style, FALSE ); HWND hwnd = CreateWindowA( title, title, style, 0, 0, rct.right - rct.left, rct.bottom - rct.top, 0, 0, instance, 0 ); if( hwnd ) { this->hInstance = instance; this->hWnd = hwnd; this->title = title; GetClientRect( hwnd, &rct ); this->width = rct.right - rct.left; this->height = rct.bottom - rct.top; this->hInstance = instance; this->fullscreen = fullscreen; this->done = false; this->updateFlag = true; SetWindowLongPtrA( hWnd, GWLP_USERDATA, reinterpret_cast<LONG_PTR>( this ) ); UpdateWindow( hwnd ); ShowWindow( hwnd, SW_SHOW ); return true; } UnregisterClassA( title, instance ); return false; }
void Win32Window::Destroy() { if (nativeDisplay) { ReleaseDC(nativeWindow, nativeDisplay); nativeDisplay = 0; } if (nativeWindow) { DestroyWindow(nativeWindow); nativeWindow = 0; } if (parentWindow) { DestroyWindow(parentWindow); parentWindow = 0; } UnregisterClassA(parentClassName.c_str(), NULL); UnregisterClassA(childClassName.c_str(), NULL); }
void Win32Window::unregisterWindowClass() { m_WindowClassRegistered--; if(m_WindowClassRegistered != 0) { return; } UnregisterClassA(ARX_WINDOW_CLASS, GetModuleHandle(0)); m_WindowsMap.clear(); }
Win32Assistant::~Win32Assistant () { //SetConsoleOutputCP (oldCP); if (!is_console_app && (console_window || cmdline_help_wanted)) FreeConsole(); if (cswinIsWinNT ()) UnregisterClassW ((WCHAR*)windowClass, ModuleHandle); else UnregisterClassA ((char*)windowClass, ModuleHandle); delete[] windowClass; }
static BOOL xxDigHoleInWndClasses(LONG b, LONG e) { BOOL bReturn = FALSE; CHAR buf[0x10] = { 0 }; for (LONG i = b; i < e; i++) { sprintf(buf, "CLS_%d", i); bReturn = UnregisterClassA(buf, NULL); } return bReturn; }
static void cleanup(void) { MSG msg; PostMessageA(hProgressParentWnd, WM_CLOSE, 0, 0); while (GetMessageA(&msg,0,0,0)) { TranslateMessage(&msg); DispatchMessageA(&msg); } UnregisterClassA(progressTestClass, GetModuleHandleA(NULL)); }
static BOOL xxUnregisterWndClasses(VOID) { BOOL bReturn = FALSE; CHAR buf[0x10] = { 0 }; for (LONG i = 0; i < tmpTimes; i++) { sprintf(buf, "CLS_%d", i); bReturn = UnregisterClassA(buf, NULL); } return bReturn; }
//Unregisters, releases the DC if needed, and destroys the window. void WinDestroy() { if ((WindowDC != NULL) && (ReleaseDC(WindowHandle, WindowDC) == 0)){ WindowDC = 0; } if ((!WindowHandle == 0) && (!(DestroyWindow(WindowHandle)))){ WindowHandle = 0; } if (!(UnregisterClassA(szWindowClass, WindowINST))){ WindowINST = 0; } };
void DisplayD3D::terminate() { SafeDelete(mDevice); SafeDelete(mRenderer); #if !defined(ANGLE_ENABLE_WINDOWS_STORE) if (mChildWindowClass != 0) { UnregisterClassA(reinterpret_cast<const char*>(mChildWindowClass), NULL); mChildWindowClass = 0; } #endif }
static void cleanup(void) { MSG msg; PostMessageA(hComboExParentWnd, WM_CLOSE, 0, 0); while (GetMessageA(&msg,0,0,0)) { TranslateMessage(&msg); DispatchMessageA(&msg); } DestroyWindow(hComboExParentWnd); UnregisterClassA(ComboExTestClass, GetModuleHandleA(NULL)); }
QEventDispatcherWin32Private::~QEventDispatcherWin32Private() { wakeUpNotifier.setEnabled(false); CloseHandle(wakeUpNotifier.handle()); if (internalHwnd) DestroyWindow(internalHwnd); QByteArray className = "QEventDispatcherWin32_Internal_Widget" + QByteArray::number(quintptr(qt_internal_proc)); #if !defined(Q_OS_WINCE) UnregisterClassA(className.constData(), qWinAppInst()); #else UnregisterClassW(reinterpret_cast<const wchar_t *> (QString::fromLatin1(className.constData()).utf16()), qWinAppInst()); #endif }
void Win32Window::destroy() { if (mNativeDisplay) { ReleaseDC(mNativeWindow, mNativeDisplay); mNativeDisplay = 0; } if (mNativeWindow) { DestroyWindow(mNativeWindow); mNativeWindow = 0; } if (mParentWindow) { DestroyWindow(mParentWindow); mParentWindow = 0; } UnregisterClassA(mParentClassName.c_str(), NULL); UnregisterClassA(mChildClassName.c_str(), NULL); }
void CSplashScreen::Terminate(void) { // Release the bitmap if (0 != mBitmap) { DeleteObject(mBitmap); mBitmap = NULL; } // Destroy the window DestroyWindow(mSplashWindow); // Unregister class UnregisterClassA("Splash", GetModuleHandle(NULL)); }
void CodePreview::Unregister() { UnregisterClassA(s_className, _AtlModule.GetResourceInstance()); if(s_normalFont) { DeleteObject(s_normalFont); s_normalFont = 0; } if(s_boldFont) { DeleteObject(s_boldFont); s_boldFont = 0; } }
/* Initialization function */ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { TRACE("\n"); switch (fdwReason) { case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls(hinstDLL); return RICHED32_Register(); case DLL_PROCESS_DETACH: if (lpvReserved) break; UnregisterClassA(RICHEDIT_CLASS10A, NULL); break; } return TRUE; }