BOOL WINAPI AtlAxWinInit(void) { WNDCLASSEXW wcex; const WCHAR AtlAxWin100[] = {'A','t','l','A','x','W','i','n','1','0','0',0}; const WCHAR AtlAxWinLic100[] = {'A','t','l','A','x','W','i','n','L','i','c','1','0','0',0}; FIXME("semi-stub\n"); if ( FAILED( OleInitialize(NULL) ) ) return FALSE; wcex.cbSize = sizeof(wcex); wcex.style = CS_GLOBALCLASS | CS_DBLCLKS; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = GetModuleHandleW( NULL ); wcex.hIcon = NULL; wcex.hCursor = NULL; wcex.hbrBackground = NULL; wcex.lpszMenuName = NULL; wcex.hIconSm = 0; wcex.lpfnWndProc = AtlAxWin_wndproc; wcex.lpszClassName = AtlAxWin100; if ( !RegisterClassExW( &wcex ) ) return FALSE; wcex.lpszClassName = AtlAxWinLic100; if ( !RegisterClassExW( &wcex ) ) return FALSE; return TRUE; }
static BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) { WCHAR empty = 0; WNDCLASSEXW wndclass = {0}; /* Frame class */ wndclass.cbSize = sizeof(WNDCLASSEXW); wndclass.style = CS_HREDRAW | CS_VREDRAW; wndclass.lpfnWndProc = FrameWndProc; wndclass.hInstance = hInstance; wndclass.hIcon = LoadIconW(hInstance, MAKEINTRESOURCEW(IDI_REGEDIT)); wndclass.hCursor = LoadCursorW(0, (LPCWSTR)IDC_ARROW); wndclass.lpszClassName = szFrameClass; wndclass.hIconSm = LoadImageW(hInstance, MAKEINTRESOURCEW(IDI_REGEDIT), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED); RegisterClassExW(&wndclass); /* Child class */ wndclass.lpfnWndProc = ChildWndProc; wndclass.cbWndExtra = sizeof(HANDLE); wndclass.lpszClassName = szChildClass; RegisterClassExW(&wndclass); hMenuFrame = LoadMenuW(hInstance, MAKEINTRESOURCEW(IDR_REGEDIT_MENU)); hPopupMenus = LoadMenuW(hInstance, MAKEINTRESOURCEW(IDR_POPUP_MENUS)); /* Initialize the Windows Common Controls DLL */ InitCommonControls(); /* register our hex editor control */ HexEdit_Register(); nClipboardFormat = RegisterClipboardFormatW(strClipboardFormat); hFrameWnd = CreateWindowExW(0, szFrameClass, szTitle, WS_OVERLAPPEDWINDOW | WS_EX_CLIENTEDGE, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, hMenuFrame, hInstance, NULL/*lpParam*/); if (!hFrameWnd) { return FALSE; } /* Create the status bar */ hStatusBar = CreateStatusWindowW(WS_VISIBLE|WS_CHILD|WS_CLIPSIBLINGS|SBT_NOBORDERS, &empty, hFrameWnd, STATUS_WINDOW); if (hStatusBar) { /* Create the status bar panes */ SetupStatusBar(hFrameWnd, FALSE); CheckMenuItem(GetSubMenu(hMenuFrame, ID_VIEW_MENU), ID_VIEW_STATUSBAR, MF_BYCOMMAND|MF_CHECKED); } ShowWindow(hFrameWnd, nCmdShow); UpdateWindow(hFrameWnd); return TRUE; }
BOOL WINAPI AtlAxWinInit(void) { WNDCLASSEXW wcex; #if _ATL_VER <= _ATL_VER_30 #define ATL_NAME_SUFFIX 0 #elif _ATL_VER == _ATL_VER_80 #define ATL_NAME_SUFFIX '8','0',0 #elif _ATL_VER == _ATL_VER_90 #define ATL_NAME_SUFFIX '9','0',0 #elif _ATL_VER == _ATL_VER_100 #define ATL_NAME_SUFFIX '1','0','0',0 #elif _ATL_VER == _ATL_VER_110 #define ATL_NAME_SUFFIX '1','1','0',0 #else #error Unsupported version #endif const WCHAR AtlAxWinW[] = {'A','t','l','A','x','W','i','n',ATL_NAME_SUFFIX}; FIXME("version %04x semi-stub\n", _ATL_VER); if ( FAILED( OleInitialize(NULL) ) ) return FALSE; wcex.cbSize = sizeof(wcex); wcex.style = CS_GLOBALCLASS | (_ATL_VER > _ATL_VER_30 ? CS_DBLCLKS : 0); wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = GetModuleHandleW( NULL ); wcex.hIcon = NULL; wcex.hCursor = NULL; wcex.hbrBackground = NULL; wcex.lpszMenuName = NULL; wcex.hIconSm = 0; wcex.lpfnWndProc = AtlAxWin_wndproc; wcex.lpszClassName = AtlAxWinW; if ( !RegisterClassExW( &wcex ) ) return FALSE; if(_ATL_VER > _ATL_VER_30) { const WCHAR AtlAxWinLicW[] = {'A','t','l','A','x','W','i','n','L','i','c',ATL_NAME_SUFFIX}; wcex.lpszClassName = AtlAxWinLicW; if ( !RegisterClassExW( &wcex ) ) return FALSE; } return TRUE; }
/*-------------------------------------- * Function: registerWindowClass() *------------------------------------*/ static void registerWindowClass(void) { WNDCLASSEXW wcx = { 0 }; wchar_t* class_name = wstrdup(ClassName); wcx.cbSize = sizeof(WNDCLASSEXW); wcx.style = CS_HREDRAW | CS_VREDRAW; wcx.lpfnWndProc = WindowProc; wcx.cbClsExtra = 0; wcx.cbWndExtra = 0; wcx.hInstance = GetModuleHandleW(NULL); wcx.hIcon = LoadIconW(NULL, IDI_APPLICATION); wcx.hCursor = LoadCursorW(NULL, IDC_ARROW); wcx.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wcx.lpszMenuName = NULL; wcx.lpszClassName = class_name; wcx.hIconSm = NULL; if (!RegisterClassExW(&wcx)) { free(class_name); error("could not register window class"); } free(class_name); }
void OSGLContext_win::initWGLData(OSGLContext_wgl_data* wglInfo) { memset( wglInfo, 0, sizeof(OSGLContext_wgl_data) ); wglInfo->instance = LoadLibraryW(L"opengl32.dll"); if (!wglInfo->instance) { throw std::runtime_error("WGL: Failed to load opengl32.dll"); } wglInfo->CreateContext = (WGLCREATECONTEXT_T)GetProcAddress(wglInfo->instance, "wglCreateContext"); wglInfo->DeleteContext = (WGLDELETECONTEXT_T)GetProcAddress(wglInfo->instance, "wglDeleteContext"); wglInfo->GetProcAddress = (WGLGETPROCADDRESS_T)GetProcAddress(wglInfo->instance, "wglGetProcAddress"); wglInfo->MakeCurrent = (WGLMAKECURRENT_T)GetProcAddress(wglInfo->instance, "wglMakeCurrent"); wglInfo->ShareLists = (WGLSHARELISTS_T)GetProcAddress(wglInfo->instance, "wglShareLists"); WNDCLASSEXW wc; ZeroMemory( &wc, sizeof(wc) ); wc.cbSize = sizeof(wc); wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; wc.lpfnWndProc = (WNDPROC) DefWindowProcW; wc.hInstance = GetModuleHandleW(NULL); wc.hCursor = 0;//LoadCursorW(NULL, IDC_ARROW); wc.lpszClassName = NATRON_WNDCLASSNAME; bool ok = (bool)RegisterClassExW(&wc); assert(ok); Q_UNUSED(ok); }
static void _initWndClass(){ static int _done; if( _done ) return; if( _bbusew ){ WNDCLASSEXW wc={sizeof(wc)}; wc.style=CS_HREDRAW|CS_VREDRAW|CS_OWNDC; wc.lpfnWndProc=(WNDPROC)_wndProc; wc.hInstance=GetModuleHandle(0); wc.lpszClassName=CLASS_NAMEW; wc.hCursor=(HCURSOR)LoadCursor( 0,IDC_ARROW ); wc.hIcon = bbAppIcon(wc.hInstance); wc.hbrBackground=0; if( !RegisterClassExW( &wc ) ) exit( -1 ); }else{ WNDCLASSEX wc={sizeof(wc)}; wc.style=CS_HREDRAW|CS_VREDRAW|CS_OWNDC; wc.lpfnWndProc=(WNDPROC)_wndProc; wc.hInstance=GetModuleHandle(0); wc.lpszClassName=CLASS_NAME; wc.hCursor=(HCURSOR)LoadCursor( 0,IDC_ARROW ); wc.hIcon = bbAppIcon(wc.hInstance); wc.hbrBackground=0; if( !RegisterClassEx( &wc ) ) exit( -1 ); } _done=1; }
int CreateGlWindow(HINSTANCE hInstance) { WNDCLASSEXW wc; Zero(wc); wc.cbSize = sizeof(wc); wc.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW | CS_OWNDC; wc.lpfnWndProc = (WNDPROC)glWindowProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)NULL; wc.lpszClassName = L"UPP-GL-CLASS"; RegisterClassExW(&wc); glHwnd = CreateWindowW( L"UPP-GL-CLASS", L"", WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX | WS_SYSMENU, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); if(!glHwnd) return -1; return 1; }
ATOM MyRegisterClass(HINSTANCE hInstance) { WNDCLASSEXW wcex; wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = 0; wcex.lpfnWndProc = WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInstance; wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_EVENTVWR)); wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wcex.lpszMenuName = MAKEINTRESOURCE(IDM_EVENTVWR); wcex.lpszClassName = szWindowClass; wcex.hIconSm = (HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_EVENTVWR), IMAGE_ICON, 16, 16, LR_SHARED); return RegisterClassExW(&wcex); }
/* Author : mah Date : 13.06.2002 Description : Constructs window class InputBox */ CInputBox::CInputBox(HWND hWndParent) { HINSTANCE hInst = GetModuleHandle(NULL); WNDCLASSEXW wcex; if (!GetClassInfoExW(hInst, L"InputBox", &wcex)) { wcex.cbSize = sizeof(WNDCLASSEXW); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = (WNDPROC)WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = 0; wcex.hInstance = hInst; wcex.hIcon = NULL;//LoadIcon(hInst, (LPCTSTR)IDI_MYINPUTBOX); wcex.hCursor = LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW); wcex.lpszMenuName = NULL; wcex.lpszClassName = L"InputBox"; wcex.hIconSm = NULL; if (RegisterClassExW(&wcex) == 0) MessageBoxW(NULL, L"Can't create CInputBox!", L"Error", MB_OK); } m_hWndParent = hWndParent; Text = NULL; }
static HWND InitInstance(HINSTANCE hInst) { WCHAR szClass[] = L"CharMap"; WCHAR szTitle[256]; WNDCLASSEXW wc; HWND hWnd; LoadStringW(hInst, IDS_TITLE, szTitle, SIZEOF(szTitle)); hSmIcon = LoadImage(hInstance, MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON, 16, 16, 0); hBgIcon = LoadImage(hInstance, MAKEINTRESOURCE(IDI_ICON), IMAGE_ICON, 32, 32, 0); // Create workspace ZeroMemory(&wc, sizeof(wc)); wc.cbSize = sizeof(wc); wc.lpfnWndProc = PanelWndProc; wc.hInstance = hInst; wc.hIcon = hBgIcon; wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)GetStockObject(NULL_BRUSH); wc.lpszMenuName = NULL; wc.lpszClassName = szClass; wc.hIconSm = hSmIcon; RegisterClassExW(&wc); hWnd = CreateWindowW( szClass, szTitle, WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInst, NULL); if (hWnd != NULL) { ShowWindow(hWnd, SW_SHOW); UpdateWindow(hWnd); } return hWnd; }
void create_doc_view_hwnd(DocHost *This) { RECT rect; static const WCHAR wszShell_DocObject_View[] = {'S','h','e','l','l',' ','D','o','c','O','b','j','e','c','t',' ','V','i','e','w',0}; if(!doc_view_atom) { static WNDCLASSEXW wndclass = { sizeof(wndclass), CS_PARENTDC, doc_view_proc, 0, 0 /* native uses 4*/, NULL, NULL, NULL, (HBRUSH)(COLOR_WINDOW + 1), NULL, wszShell_DocObject_View, NULL }; wndclass.hInstance = shdocvw_hinstance; doc_view_atom = RegisterClassExW(&wndclass); } This->container_vtbl->GetDocObjRect(This, &rect); This->hwnd = CreateWindowExW(0, wszShell_DocObject_View, wszShell_DocObject_View, WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_TABSTOP, rect.left, rect.top, rect.right, rect.bottom, This->frame_hwnd, NULL, shdocvw_hinstance, This); }
// Registers the GLFW window class // GLFWbool _glfwRegisterWindowClassWin32(void) { WNDCLASSEXW wc; ZeroMemory(&wc, sizeof(wc)); wc.cbSize = sizeof(wc); wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; wc.lpfnWndProc = (WNDPROC) windowProc; wc.cbWndExtra = sizeof(void*) + sizeof(int); // Make room for one pointer wc.hInstance = GetModuleHandleW(NULL); wc.hCursor = LoadCursorW(NULL, IDC_ARROW); wc.lpszClassName = _GLFW_WNDCLASSNAME; // Load user-provided icon if available wc.hIcon = LoadImageW(GetModuleHandleW(NULL), L"GLFW_ICON", IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_SHARED); if (!wc.hIcon) { // No user-provided icon found, load default icon wc.hIcon = LoadImageW(NULL, IDI_APPLICATION, IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_SHARED); } if (!RegisterClassExW(&wc)) { _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to register window class"); return GLFW_FALSE; } return GLFW_TRUE; }
bool Canvas::Initialize() { WNDCLASSEXW wcx; wcx.cbSize = sizeof(WNDCLASSEXW); // size of structure wcx.style = CS_HREDRAW | CS_VREDRAW; // redraw if size changes wcx.lpfnWndProc = stWindowProc; // points to window procedure wcx.cbClsExtra = 0; // no extra class memory wcx.cbWndExtra = 0; // no extra window memory wcx.hInstance = NULL; // handle to instance wcx.hIcon = LoadIcon(NULL, IDI_APPLICATION); // predefined app. icon wcx.hCursor = LoadCursor(NULL, IDC_ARROW); // predefined arrow wcx.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); // white background brush wcx.lpszMenuName = NULL; // name of menu resource wcx.lpszClassName = CANVAS_WINDOW_CLASS_NAME; // name of window class wcx.hIconSm = LoadIcon(NULL, IDI_APPLICATION); // small class icon RegisterClassExW(&wcx); m_hwnd = CreateWindowW(wcx.lpszClassName, L"CanvasWindow", WS_POPUP | WS_EX_TOPMOST, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, NULL, (void *)this); return true; }
static BOOL InitApplication(HINSTANCE hInstance) { WNDCLASSEXW wc; /* Load the application description strings */ LoadStringW(hInstance, IDS_DESCRIPTION, szTitle, sizeof(szTitle)/sizeof(WCHAR)); /* Fill in window class structure with parameters that describe the main window */ wc.cbSize = sizeof(WNDCLASSEXW); wc.style = CS_HREDRAW | CS_VREDRAW; /* Class style(s) */ wc.lpfnWndProc = WndProc; /* Window Procedure */ wc.cbClsExtra = 0; /* No per-class extra data */ wc.cbWndExtra = 0; /* No per-window extra data */ wc.hInstance = hInstance; /* Owner of this class */ wc.hIcon = NULL; wc.hIconSm = NULL; wc.hCursor = LoadCursorW(NULL, (LPWSTR)IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); /* Default color */ wc.lpszMenuName = szAppName; /* Menu name from .rc */ wc.lpszClassName = szAppName; /* Name to register as */ if (!RegisterClassExW(&wc)) return FALSE; /* Call module specific initialization functions here */ return TRUE; }
ATOM UT_RegisterClassEx(UINT style, WNDPROC wndproc, HINSTANCE hInstance, HICON hIcon, HCURSOR hCursor, HBRUSH hbrBackground, HICON hIconSm, const wchar_t * menu, const wchar_t * name) { ATOM atom; WNDCLASSEXW wndclass; memset(&wndclass, 0, sizeof(wndclass)); wndclass.cbSize = sizeof(wndclass); wndclass.style = style; wndclass.lpfnWndProc = wndproc; wndclass.cbClsExtra = 0; wndclass.cbWndExtra = 0; wndclass.hInstance = hInstance; wndclass.hIcon = hIcon; wndclass.hCursor = hCursor; wndclass.hbrBackground = hbrBackground; wndclass.lpszMenuName = menu; wndclass.lpszClassName = name; wndclass.hIconSm = hIconSm; atom = RegisterClassExW (&wndclass); UT_ASSERT(atom); return atom; }
bool RInput::_initialise(){ if(true == RInput::_initialised){ return true; } WNDCLASSEX window_class = {0}; window_class.cbSize = sizeof(WNDCLASSEX); window_class.lpfnWndProc = RInput::window_procedure; window_class.hInstance = GetModuleHandleW(0); window_class.lpszClassName = L"4D4B_RINPUT"; RInput::_window_class = RegisterClassExW(&window_class); if(0 == RInput::_window_class){ std::cerr << "RInput::_initialise(): 0 == RInput::_window_class, GetLastError(): " << std::dec << GetLastError() << std::endl; RInput::_initialised = false; return false; } RInput::_hwnd_message = CreateWindowExW(0,L"4D4B_RINPUT",0,0,0,0,0,0,HWND_MESSAGE,0,0,0); if(0 == RInput::_hwnd_message){ std::cerr << "RInput::_initialise(): 0 == RInput::_hwnd_message, GetLastError(): " << std::dec << GetLastError() << std::endl; RInput::_initialised = false; return false; } RInput::_rinput_instance = std::shared_ptr<RInput>(this); return RInput::_initialised = true; }
/* This is the only public function, it registers the class */ BOOL Display_InitClass(HINSTANCE hInstance) { WNDCLASSEXW wincl; /* Set the fontdisplay window class structure */ wincl.cbSize = sizeof(WNDCLASSEX); wincl.style = CS_DBLCLKS; wincl.lpfnWndProc = DisplayProc; wincl.cbClsExtra = 0; wincl.cbWndExtra = 0; wincl.hInstance = hInstance; wincl.hIcon = NULL; wincl.hCursor = LoadCursor (NULL, IDC_ARROW); wincl.hbrBackground = GetStockObject(WHITE_BRUSH); wincl.lpszMenuName = NULL; wincl.lpszClassName = g_szFontDisplayClassName; wincl.hIconSm = NULL; /* Register the window class, and if it fails return FALSE */ if (!RegisterClassExW (&wincl)) { return FALSE; } return TRUE; }
HWND get_notif_hwnd(void) { #ifdef __REACTOS__ static ATOM wnd_class = 0; #endif tls_data_t *tls_data; #ifdef __REACTOS__ static const WCHAR wszURLMonikerNotificationWindow[] = {'U','R','L',' ','M','o','n','i','k','e','r',' ', 'N','o','t','i','f','i','c','a','t','i','o','n',' ','W','i','n','d','o','w',0}; #else static INIT_ONCE init_once = INIT_ONCE_STATIC_INIT; #endif tls_data = get_tls_data(); if(!tls_data) return NULL; if(tls_data->notif_hwnd_cnt) { tls_data->notif_hwnd_cnt++; return tls_data->notif_hwnd; } #ifndef __REACTOS__ InitOnceExecuteOnce(&init_once, register_notif_wnd_class, NULL, NULL); if(!notif_wnd_class) return NULL; #else if(!wnd_class) { static WNDCLASSEXW wndclass = { sizeof(wndclass), 0, notif_wnd_proc, 0, 0, NULL, NULL, NULL, NULL, NULL, wszURLMonikerNotificationWindow, NULL }; wndclass.hInstance = hProxyDll; wnd_class = RegisterClassExW(&wndclass); if (!wnd_class && GetLastError() == ERROR_CLASS_ALREADY_EXISTS) wnd_class = 1; } #endif #ifndef __REACTOS__ tls_data->notif_hwnd = CreateWindowExW(0, MAKEINTRESOURCEW(notif_wnd_class), #else tls_data->notif_hwnd = CreateWindowExW(0, wszURLMonikerNotificationWindow, #endif wszURLMonikerNotificationWindow, 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, hProxyDll, NULL); if(tls_data->notif_hwnd) tls_data->notif_hwnd_cnt++; TRACE("hwnd = %p\n", tls_data->notif_hwnd); return tls_data->notif_hwnd; }
void Window::Register() try { HINSTANCE instanceHandle = GetModuleHandleW(nullptr); WNDCLASSEXW windowClass; ZeroMemory(&windowClass, sizeof(windowClass)); windowClass.cbSize = sizeof(WNDCLASSEXW); windowClass.style = CS_OWNDC; windowClass.lpfnWndProc = WindowHandleMessage; windowClass.hInstance = instanceHandle; windowClass.hIcon = LoadIconW(instanceHandle, MAKEINTRESOURCEW(IDI_ICON1)); windowClass.hCursor = LoadCursorW(nullptr, MAKEINTRESOURCEW(IDI_APPLICATION)); windowClass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); windowClass.lpszMenuName = nullptr; windowClass.lpszClassName = CLASS_NAME; if (!RegisterClassExW(&windowClass)) { throw std::runtime_error("Registration of Window failed"); } wasRegistered = true; } catch (std::runtime_error error) { MessageBoxA(0, error.what(), "Error!", MB_ICONEXCLAMATION | MB_OK); PostQuitMessage(-1); }
ATOM MyRegisterClass(HINSTANCE hInstance) { WNDCLASSEXW wcex = {0}; wcex.cbSize = sizeof(WNDCLASSEX); wcex.lpfnWndProc = WndProc; wcex.hInstance = hInstance; wcex.lpszClassName = WND_CLASS; return RegisterClassExW(&wcex); }
ATOM RegisterWinClass(const wchar_t* pszName, WNDPROC proc) { WNDCLASSEXW wc = {}; wc.cbSize = sizeof(wc); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = proc; wc.lpszClassName = pszName; wc.hbrBackground = GetSysColorBrush(COLOR_APPWORKSPACE); // no draw wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hInstance = nullptr; return RegisterClassExW(&wc); }
MusPlayer_WinAPI::MusPlayer_WinAPI(HINSTANCE hInstance, int nCmdShow) : MusPlayerBase() { assert(!MusPlayer_WinAPI::m_self && "Multiple instances of MainWindow are Forbidden! It's singleton!"); MusPlayer_WinAPI::m_self = this; m_MainWndClass = L"PGEMusPlayer"; m_hInstance = hInstance; INITCOMMONCONTROLSEX icc; // Initialise common controls. icc.dwSize = sizeof(icc); icc.dwICC = ICC_WIN95_CLASSES; InitCommonControlsEx(&icc); // Class for our main window. memset(&m_wc, 0, sizeof(m_wc)); m_wc.cbSize = sizeof(m_wc); m_wc.style = 0; m_wc.lpfnWndProc = &MusPlayer_WinAPI::MainWndProc; m_wc.cbClsExtra = 0; m_wc.cbWndExtra = 0; m_wc.hInstance = hInstance; m_wc.hIcon = (HICON) LoadImage(hInstance, MAKEINTRESOURCE(IDI_ICON1), IMAGE_ICON, 0, 0, LR_DEFAULTSIZE | LR_DEFAULTCOLOR | LR_SHARED); m_wc.hCursor = (HCURSOR) LoadImage(NULL, IDC_ARROW, IMAGE_CURSOR, 0, 0, LR_SHARED); m_wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE+1); m_wc.lpszMenuName = NULL; m_wc.lpszClassName = m_MainWndClass; m_wc.hIconSm = (HICON) LoadImage(hInstance, MAKEINTRESOURCE(IDI_ICON1), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_DEFAULTCOLOR | LR_SHARED); // Register our window classes, or error. if(!RegisterClassExW(&m_wc)) { MessageBoxA(NULL, "Error registering window class.", "Error", MB_ICONERROR | MB_OK); return; } m_height = 170; // Create instance of main window. m_hWnd = CreateWindowExW(WS_EX_ACCEPTFILES, m_MainWndClass, m_MainWndClass, WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX, CW_USEDEFAULT, CW_USEDEFAULT, 320, m_height, NULL, NULL, hInstance, NULL); // Show window and force a paint. ShowWindow(m_hWnd, nCmdShow); UpdateWindow(m_hWnd); }
static BOOL WINAPI register_notif_wnd_class(INIT_ONCE *once, void *param, void **context) { static WNDCLASSEXW wndclass = { sizeof(wndclass), 0, notif_wnd_proc, 0, 0, NULL, NULL, NULL, NULL, NULL, wszURLMonikerNotificationWindow, NULL }; wndclass.hInstance = hProxyDll; notif_wnd_class = RegisterClassExW(&wndclass); return TRUE; }
void RegisterDialogClass(HWND hwnd) { WNDCLASSEXW wndc = { 0 }; BOOL CALLBACK DialogProcedure(HWND, UINT, WPARAM, LPARAM); wndc.cbSize = sizeof(WNDCLASSEXW); wndc.lpfnWndProc = (WNDPROC)DialogProc; wndc.hInstance = hInstance; wndc.hbrBackground = GetSysColorBrush(COLOR_3DFACE); wndc.lpszClassName = TEXT("DialogClass"); RegisterClassExW(&wndc); }
void Window::RegisterWindowClass() { WNDCLASSEXW wc; memset(&wc, 0, sizeof(wc)); wc.cbSize = sizeof(wc); wc.cbWndExtra = sizeof(Window*); wc.hInstance = GetModuleHandleW(nullptr); wc.lpszClassName = WndClassname.c_str(); wc.lpfnWndProc = WndProc; wc.style = CS_OWNDC; RegisterClassExW(&wc); }
ZuiOsWindow ZuiOsCreateWindow(ZuiInt Left, ZuiInt Top, ZuiInt Width, ZuiInt Height, ZuiText Title, ZuiBool ShowInTaskbar, ZuiBool PosMiddle, ZuiWindow Window) { static ZuiBool ClassRegistered;//是否注册WNDCLASS if (!ClassRegistered) { /*第一次调用该函数向系统注册ZuiUI.Window类*/ WNDCLASSEXW WindowClass; memset(&WindowClass, 0, sizeof(WindowClass)); WindowClass.cbSize = sizeof(WindowClass); WindowClass.lpfnWndProc = (WNDPROC)&ZuiOsWin32WindowProc; WindowClass.style = CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS; WindowClass.lpszClassName = L"ZuiUI.Window"; WindowClass.hCursor = LoadCursor(NULL, IDC_ARROW);/*箭头光标*/ WindowClass.hInstance = GetModuleHandleA(NULL); RegisterClassExW(&WindowClass); ClassRegistered = 1; } if (PosMiddle) { /*窗口居中*/ Left = (GetSystemMetrics(SM_CXSCREEN) - Width) / 2; Top = (GetSystemMetrics(SM_CYSCREEN) - Height) / 2; } MAKEVRECT(Window->Rect, Left, Top, Width, Height); HWND hWnd = CreateWindowExW(ShowInTaskbar ? FALSE : WS_EX_TOOLWINDOW, L"ZuiUI.Window", Title, -1811937280, Left, Top, Width, Height, NULL, NULL, NULL, NULL ); if (!IsWindow(hWnd)) { return NULL; } /*保存相关参数到VOsWindow*/ ZuiOsWindow OsWindow = (ZuiOsWindow)malloc(sizeof(ZOsWindow)); if (OsWindow) { memset(OsWindow, 0, sizeof(ZOsWindow)); OsWindow->hWnd = hWnd; OsWindow->hDC = GetDC(hWnd); OsWindow->hIMC = ImmGetContext(hWnd);//获取系统的输入法 /*屏蔽输入法*/ ImmAssociateContext(hWnd, NULL); SetPropW(OsWindow->hWnd, PROP_ID, (HANDLE)Window); return OsWindow; } return NULL; }
static void _power_notification_thread() { // This uses a thread with its own window message pump to get power // notifications. If adb runs from a non-interactive service account, this // might not work (not sure). If that happens to not work, we could use // heavyweight WMI APIs to get power notifications. But for the common case // of a developer's interactive session, a window message pump is more // appropriate. D("Created power notification thread"); adb_thread_setname("Power Notifier"); // Window class names are process specific. static const WCHAR kPowerNotificationWindowClassName[] = L"PowerNotificationWindow"; // Get the HINSTANCE corresponding to the module that _power_window_proc // is in (the main module). const HINSTANCE instance = GetModuleHandleW(nullptr); if (!instance) { // This is such a common API call that this should never fail. LOG(FATAL) << "GetModuleHandleW failed: " << android::base::SystemErrorCodeToString(GetLastError()); } WNDCLASSEXW wndclass; memset(&wndclass, 0, sizeof(wndclass)); wndclass.cbSize = sizeof(wndclass); wndclass.lpfnWndProc = _power_window_proc; wndclass.hInstance = instance; wndclass.lpszClassName = kPowerNotificationWindowClassName; if (!RegisterClassExW(&wndclass)) { LOG(FATAL) << "RegisterClassExW failed: " << android::base::SystemErrorCodeToString(GetLastError()); } if (!CreateWindowExW(WS_EX_NOACTIVATE, kPowerNotificationWindowClassName, L"ADB Power Notification Window", WS_POPUP, 0, 0, 0, 0, nullptr, nullptr, instance, nullptr)) { LOG(FATAL) << "CreateWindowExW failed: " << android::base::SystemErrorCodeToString(GetLastError()); } MSG msg; while (GetMessageW(&msg, nullptr, 0, 0)) { TranslateMessage(&msg); DispatchMessageW(&msg); } // GetMessageW() will return false if a quit message is posted. We don't // do that, but it might be possible for that to occur when logging off or // shutting down. Not a big deal since the whole process will be going away // soon anyway. D("Power notification thread exiting"); }
static void register_nscontainer_class(void) { static WNDCLASSEXW wndclass = { sizeof(WNDCLASSEXW), CS_DBLCLKS, nsembed_proc, 0, 0, NULL, NULL, NULL, NULL, NULL, wszNsContainer, NULL, }; wndclass.hInstance = hInst; nscontainer_class = RegisterClassExW(&wndclass); }
static void register_serverwnd_class(void) { static WNDCLASSEXW wndclass = { sizeof(WNDCLASSEXW), CS_DBLCLKS, serverwnd_proc, 0, 0, NULL, NULL, NULL, NULL, NULL, wszInternetExplorer_Server, NULL, }; wndclass.hInstance = hInst; serverwnd_class = RegisterClassExW(&wndclass); }
BOOL CMainWindow::Initialize(LPCTSTR lpCaption, int nCmdShow) { WNDCLASSEXW wc = {0}; /* Store the show window value */ m_CmdShow = nCmdShow; /* Setup the window class struct */ wc.cbSize = sizeof(WNDCLASSEXW); wc.lpfnWndProc = MainWndProc; wc.hInstance = g_hInstance; wc.hIcon = LoadIconW(g_hInstance, MAKEINTRESOURCEW(IDI_DISPLAYSLEEP)); wc.hCursor = LoadCursorW(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); wc.lpszMenuName = NULL; wc.lpszClassName = m_szMainWndClass; wc.hIconSm = (HICON)LoadImage(g_hInstance, MAKEINTRESOURCE(IDI_DISPLAYSLEEP), IMAGE_ICON, 16, 16, LR_SHARED); /* Register the window */ if (RegisterClassExW(&wc)) { /* Create the main window and store the info pointer */ m_hMainWnd = CreateWindowExW(WS_EX_WINDOWEDGE, m_szMainWndClass, lpCaption, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, CW_USEDEFAULT, CW_USEDEFAULT, 600, 450, NULL, NULL, g_hInstance, this); if (m_hMainWnd) { ShowWindow(m_hMainWnd, SW_NORMAL); } } /* Return creation result */ return !!(m_hMainWnd); }