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; }
// Registers the GLFW window class // GLboolean _glfwRegisterWindowClass(void) { WNDCLASSW wc; wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; wc.lpfnWndProc = (WNDPROC) windowProc; wc.cbClsExtra = 0; // No extra class data wc.cbWndExtra = sizeof(void*) + sizeof(int); // Make room for one pointer wc.hInstance = GetModuleHandleW(NULL); wc.hCursor = LoadCursorW(NULL, IDC_ARROW); wc.hbrBackground = NULL; // No background wc.lpszMenuName = NULL; // No menu wc.lpszClassName = _GLFW_WNDCLASSNAME; // Load user-provided icon if available wc.hIcon = LoadIconW(GetModuleHandleW(NULL), L"GLFW_ICON"); if (!wc.hIcon) { // No user-provided icon found, load default icon wc.hIcon = LoadIconW(NULL, IDI_WINLOGO); } if (!RegisterClassW(&wc)) { _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to register window class"); return GL_FALSE; } return GL_TRUE; }
int main(int argc, char *argv[]) { WNDCLASSW wc; MSG msg; ZeroMemory(&wc, sizeof (WNDCLASSW)); wc.lpszClassName = L"mainwin"; wc.lpfnWndProc = wndProc; wc.hInstance = GetModuleHandle(NULL); wc.hIcon = LoadIconW(NULL, IDI_APPLICATION); wc.hCursor = LoadCursorW(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1); RegisterClassW(&wc); mainwin = CreateWindowExW(0, L"mainwin", L"mainwin", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 400, 400, NULL, NULL, GetModuleHandle(NULL), NULL); if (argc > 1) dialog = CreateWindowExW(WS_EX_CONTROLPARENT, WC_DIALOG, L"", WS_CHILD | WS_VISIBLE, 100, 100, 200, 200, mainwin, NULL, GetModuleHandle(NULL), NULL); else { const BYTE dlgtemplate[] = { 0x01, 0x00, // version 0xFF, 0xFF, // signature 0x00, 0x00, 0x00, 0x00, // help 0x00, 0x00, 0x01, 0x00, // WS_EX_CONTROLPARENT 0x00, 0x00, 0x00, 0x50, // WS_CHILD | WS_VISIBLE 0x00, 0x00, // no controls 100, 0, // X/Y/Width/Height 100, 0, 100, 0, 100, 0, 0x00, 0x00, // menu 0x00, 0x00, // class 0x00, 0x00, // title 0x00, 0x00, 0x00, 0x00, // some padding 0x00, 0x00, 0x00, 0x00, // more padding 0x00, 0x00, 0x00, 0x00, // just to be safe }; dialog = CreateDialogIndirectW(GetModuleHandle(NULL), (LPCDLGTEMPLATEW) dlgtemplate, mainwin, dlgproc); } printf("%I32X\n", EnableThemeDialogTexture(dialog, ETDT_ENABLE | ETDT_USETABTEXTURE | ETDT_ENABLETAB)); ShowWindow(mainwin, SW_SHOWDEFAULT); UpdateWindow(mainwin); while (GetMessageW(&msg, NULL, 0, 0) > 0) { TranslateMessage(&msg); DispatchMessage(&msg); } return 0; }
BOOL WINAPI RegisterSystemControls(VOID) { WNDCLASSEXW WndClass; UINT i; ATOM atom; if (RegisterDefaultClasses) return TRUE; ZeroMemory(&WndClass, sizeof(WndClass)); WndClass.cbSize = sizeof(WndClass); for (i = 0; i != sizeof(g_SysClasses) / sizeof(g_SysClasses[0]); i++) { WndClass.lpszClassName = g_SysClasses[i].desc->name; // Set Global bit! WndClass.style = g_SysClasses[i].desc->style|CS_GLOBALCLASS; WndClass.lpfnWndProc = g_SysClasses[i].desc->procW; WndClass.cbWndExtra = g_SysClasses[i].desc->extra; WndClass.hCursor = LoadCursorW(NULL, g_SysClasses[i].desc->cursor); WndClass.hbrBackground= g_SysClasses[i].desc->brush; atom = RegisterClassExWOWW( &WndClass, 0, g_SysClasses[i].fnid, 0, FALSE); if (atom) RegisterDefaultClasses |= ICLASS_TO_MASK(g_SysClasses[i].ClsId); } return TRUE; }
// 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; }
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); }
BOOL WINAPI RegisterIMEClass(VOID) { WNDCLASSEXW WndClass; ATOM atom; ZeroMemory(&WndClass, sizeof(WndClass)); WndClass.cbSize = sizeof(WndClass); WndClass.lpszClassName = imeW; WndClass.style = CS_GLOBALCLASS; WndClass.lpfnWndProc = ImeWndProcW; WndClass.cbWndExtra = sizeof(LONG_PTR); WndClass.hCursor = LoadCursorW(NULL, IDC_ARROW); atom = RegisterClassExWOWW( &WndClass, 0, FNID_IME, 0, FALSE); if (atom) { RegisterDefaultClasses |= ICLASS_TO_MASK(ICLS_IME); TRACE("Register IME Class!\n"); return TRUE; } ERR("Failed to register IME Class!\n"); return FALSE; }
BOOL RefreshTreeView(HWND hwndTV) { HTREEITEM hItem; HTREEITEM hSelectedItem; HCURSOR hcursorOld; HTREEITEM hRoot; WINE_TRACE("\n"); hSelectedItem = (HTREEITEM)SendMessageW(hwndTV, TVM_GETNEXTITEM, TVGN_CARET, 0); hcursorOld = SetCursor(LoadCursorW(NULL, (LPCWSTR)IDC_WAIT)); SendMessageW(hwndTV, WM_SETREDRAW, FALSE, 0); hRoot = (HTREEITEM)SendMessageW(hwndTV, TVM_GETNEXTITEM, TVGN_ROOT, 0); hItem = (HTREEITEM)SendMessageW(hwndTV, TVM_GETNEXTITEM, TVGN_CHILD, (LPARAM)hRoot); while (hItem) { RefreshTreeItem(hwndTV, hItem); hItem = (HTREEITEM)SendMessageW(hwndTV, TVM_GETNEXTITEM, TVGN_NEXT, (LPARAM)hItem); } SendMessageW(hwndTV, WM_SETREDRAW, TRUE, 0); InvalidateRect(hwndTV, NULL, FALSE); SetCursor(hcursorOld); /* We reselect the currently selected node, this will prompt a refresh of the listview. */ SendMessageW(hwndTV, TVM_SELECTITEM, TVGN_CARET, (LPARAM)hSelectedItem); 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); }
static BOOL WINAPI register_classes( INIT_ONCE *once, void *param, void **context ) { WNDCLASSW wndClass; ZeroMemory(&wndClass, sizeof(WNDCLASSW)); wndClass.style = CS_GLOBALCLASS | CS_IME | CS_HREDRAW | CS_VREDRAW; wndClass.lpfnWndProc = IME_WindowProc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = 2 * sizeof(LONG_PTR); wndClass.hInstance = x11drv_module; wndClass.hCursor = LoadCursorW(NULL, (LPWSTR)IDC_ARROW); wndClass.hIcon = LoadIconW(NULL, (LPWSTR)IDI_APPLICATION); wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW +1); wndClass.lpszMenuName = 0; wndClass.lpszClassName = UI_CLASS_NAME; RegisterClassW(&wndClass); WM_MSIME_SERVICE = RegisterWindowMessageA("MSIMEService"); WM_MSIME_RECONVERTOPTIONS = RegisterWindowMessageA("MSIMEReconvertOptions"); WM_MSIME_MOUSE = RegisterWindowMessageA("MSIMEMouseOperation"); WM_MSIME_RECONVERTREQUEST = RegisterWindowMessageA("MSIMEReconvertRequest"); WM_MSIME_RECONVERT = RegisterWindowMessageA("MSIMEReconvert"); WM_MSIME_QUERYPOSITION = RegisterWindowMessageA("MSIMEQueryPosition"); WM_MSIME_DOCUMENTFEED = RegisterWindowMessageA("MSIMEDocumentFeed"); return TRUE; }
// 初始化 HRESULT ThisApp::Initialize(HINSTANCE hInstance, int nCmdShow){ HRESULT hr = E_FAIL; //register window class WNDCLASSEX wcex = { sizeof(WNDCLASSEX) }; wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = ThisApp::WndProc; wcex.cbClsExtra = 0; wcex.cbWndExtra = sizeof(LONG_PTR); wcex.hInstance = hInstance; wcex.hCursor = LoadCursorW(nullptr, IDC_ARROW); wcex.hbrBackground = nullptr; wcex.lpszMenuName = nullptr; wcex.lpszClassName = L"Direct2DTemplate"; wcex.hIcon = nullptr; // 注册窗口 ::RegisterClassExW(&wcex); // 计算窗口大小 RECT window_rect = { 0, 0, WNDWIDTH, WNDHEIGHT }; DWORD window_style = WS_OVERLAPPEDWINDOW; ::AdjustWindowRect(&window_rect, window_style, FALSE); window_rect.right -= window_rect.left; window_rect.bottom -= window_rect.top; window_rect.left = (::GetSystemMetrics(SM_CXFULLSCREEN) - window_rect.right) / 2; window_rect.top = (::GetSystemMetrics(SM_CYFULLSCREEN) - window_rect.bottom) / 2; // 创建窗口 m_hwnd = ::CreateWindowExW( #ifdef USING_DirectComposition WS_EX_NOREDIRECTIONBITMAP, #else 0, #endif wcex.lpszClassName, TITLE, window_style, window_rect.left, window_rect.top, window_rect.right, window_rect.bottom, 0, 0, hInstance, this ); hr = m_hwnd ? S_OK : E_FAIL; // 设置窗口句柄 if (SUCCEEDED(hr)) { hr = m_ImagaRenderer.SetHwnd(m_hwnd); } // 显示窗口 if (SUCCEEDED(hr)) { ::ShowWindow(m_hwnd, nCmdShow); ::UpdateWindow(m_hwnd); m_threadRender.std::thread::~thread(); m_threadRender.std::thread::thread( [this]() { ::CoInitialize(nullptr); while (true) { m_ImagaRenderer.OnRender(1); if (m_bExit) break; } ::CoUninitialize(); return S_OK; } ); } return hr; }
/* * SdtSaveListToFile * * Purpose: * * Dump table to the selected file * */ VOID SdtSaveListToFile( _In_ HWND hwndDlg ) { WCHAR ch; INT BufferSize = 0; INT numitems; INT row, subitem; SIZE_T sz, k; LPWSTR pItem = NULL; HCURSOR hSaveCursor; HCURSOR hHourGlass; WCHAR szTempBuffer[MAX_PATH + 1]; RtlSecureZeroMemory(szTempBuffer, sizeof(szTempBuffer)); _strcpy(szTempBuffer, TEXT("list.txt")); if (supSaveDialogExecute(hwndDlg, (LPWSTR)&szTempBuffer, TEXT("Text files\0*.txt\0\0"))) { hHourGlass = LoadCursorW(NULL, IDC_WAIT); ch = (WCHAR)0xFEFF; supWriteBufferToFile(szTempBuffer, &ch, sizeof(WCHAR), FALSE, FALSE); SetCapture(hwndDlg); hSaveCursor = SetCursor(hHourGlass); numitems = ListView_GetItemCount(SdtDlgContext.ListView); for (row = 0; row < numitems; row++) { output[0] = 0; for (subitem = 0; subitem < SdtDlgContext.lvColumnCount; subitem++) { sz = 0; pItem = supGetItemText(SdtDlgContext.ListView, row, subitem, &sz); if (pItem) { _strcat(output, pItem); HeapFree(GetProcessHeap(), 0, pItem); } if (subitem == 1) { for (k = 54; k > sz / sizeof(WCHAR); k--) { _strcat(output, TEXT(" ")); } } else { _strcat(output, TEXT("\t")); } } _strcat(output, L"\r\n"); BufferSize = (INT)_strlen(output); supWriteBufferToFile(szTempBuffer, output, BufferSize * sizeof(WCHAR), FALSE, TRUE); } SetCursor(hSaveCursor); ReleaseCapture(); } }
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; }
/****************************************************************************** * FillTreeView [Internal] * * For each child (given by lpe) of the parent shell folder, which is given by * lpsf and whose PIDL is pidl, insert a treeview-item right under hParent * * PARAMS * info [I] data for the dialog * lpsf [I] IShellFolder interface of the parent shell folder * pidl [I] ITEMIDLIST of the parent shell folder * hParent [I] The treeview item that represents the parent shell folder * lpe [I] An iterator for the children of the parent shell folder */ static void FillTreeView( browse_info *info, IShellFolder * lpsf, LPITEMIDLIST pidl, HTREEITEM hParent, IEnumIDList* lpe) { HTREEITEM hPrev = 0; LPITEMIDLIST pidlTemp = 0; ULONG ulFetched; HRESULT hr; HWND hwnd = GetParent( info->hwndTreeView ); TRACE("%p %p %p %p\n",lpsf, pidl, hParent, lpe); /* No IEnumIDList -> No children */ if (!lpe) return; SetCapture( hwnd ); SetCursor( LoadCursorA( 0, (LPSTR)IDC_WAIT ) ); while (NOERROR == IEnumIDList_Next(lpe,1,&pidlTemp,&ulFetched)) { ULONG ulAttrs = SFGAO_HASSUBFOLDER | SFGAO_FOLDER; IEnumIDList* pEnumIL = NULL; IShellFolder* pSFChild = NULL; IShellFolder_GetAttributesOf(lpsf, 1, (LPCITEMIDLIST*)&pidlTemp, &ulAttrs); if (ulAttrs & SFGAO_FOLDER) { hr = IShellFolder_BindToObject(lpsf,pidlTemp,NULL,&IID_IShellFolder,(LPVOID*)&pSFChild); if (SUCCEEDED(hr)) { DWORD flags = BrowseFlagsToSHCONTF(info->lpBrowseInfo->ulFlags); hr = IShellFolder_EnumObjects(pSFChild, hwnd, flags, &pEnumIL); if (hr == S_OK) { if ((IEnumIDList_Skip(pEnumIL, 1) != S_OK) || FAILED(IEnumIDList_Reset(pEnumIL))) { IEnumIDList_Release(pEnumIL); pEnumIL = NULL; } } IShellFolder_Release(pSFChild); } } if (!(hPrev = InsertTreeViewItem(info, lpsf, pidlTemp, pidl, pEnumIL, hParent))) goto done; SHFree(pidlTemp); /* Finally, free the pidl that the shell gave us... */ pidlTemp=NULL; } done: ReleaseCapture(); SetCursor(LoadCursorW(0, (LPWSTR)IDC_ARROW)); SHFree(pidlTemp); }
static void hugsprim_LoadCursorW_1(HugsStackPtr hugs_root) { HsPtr arg1; HsPtr arg2; HsPtr res1; arg1 = hugs->getPtr(); arg2 = hugs->getPtr(); res1 = LoadCursorW(arg1, arg2); hugs->putPtr(res1); hugs->returnIO(hugs_root,1); }
void UGameWindow::ShowCursor(bool bVisible) { if (bVisible) { SetCursor(LoadCursorW(nullptr, IDC_ARROW)); } else { SetCursor(NULL); } }
void BURGER_API Burger::OSCursor::SetImageFromIDNumber(eCursor eCursorNumber) { // Was there a change? if (eCursorNumber!=g_Global.m_eIDNumber) { WordPtr uCursorResource = 0; if (eCursorNumber!=CURSOR_NONE) { HINSTANCE hInstance; // Reset to the system cursor? if (eCursorNumber < CURSOR_COUNT) { uCursorResource = g_uSystemCursors[eCursorNumber-1]; hInstance = NULL; } else { uCursorResource = static_cast<WordPtr>(eCursorNumber); hInstance = Globals::GetInstance(); } // Try from the application's resource HCURSOR hCurs = LoadCursorW(hInstance,MAKEINTRESOURCEW(uCursorResource)); // Did it load? if (!hCurs) { // Try the operating system instead hCurs = LoadCursorW(NULL,MAKEINTRESOURCEW(g_uSystemCursors[0])); } if (hCurs) { g_Global.m_eIDNumber = eCursorNumber; g_Global.m_pCursorImage = hCurs; g_Global.m_bActiveFlag = TRUE; // Tell windows to use this cursor SetCursor(hCurs); Show(); return; } } // Force to a system cursor Hide(); SetCursor(LoadCursorW(NULL,MAKEINTRESOURCEW(g_uSystemCursors[0]))); g_Global.m_bActiveFlag = FALSE; g_Global.m_pCursorImage = NULL; g_Global.m_eIDNumber = CURSOR_NONE; } }
// Updates the cursor image according to its cursor mode // static void updateCursorImage(_GLFWwindow* window) { if (window->cursorMode == GLFW_CURSOR_NORMAL) { if (window->cursor) SetCursor(window->cursor->win32.handle); else SetCursor(LoadCursorW(NULL, IDC_ARROW)); } else SetCursor(NULL); }
/// <summary> /// Creates the main window and begins processing /// </summary> /// <param name="hInstance">handle to the application instance</param> /// <param name="nCmdShow">whether to display minimized, maximized, or normally</param> int CFaceBasics::Run(HINSTANCE hInstance, int nCmdShow) { MSG msg = {0}; WNDCLASS wc; // Dialog custom window class ZeroMemory(&wc, sizeof(wc)); wc.style = CS_HREDRAW | CS_VREDRAW; wc.cbWndExtra = DLGWINDOWEXTRA; wc.hCursor = LoadCursorW(NULL, IDC_ARROW); wc.hIcon = LoadIconW(hInstance, MAKEINTRESOURCE(IDI_APP)); wc.lpszMenuName = MAKEINTRESOURCE(IDR_MENU1); wc.lpfnWndProc = DefDlgProcW; wc.lpszClassName = L"Face-And-HDFace-Basics-D2DAppDlgWndClass"; if (!RegisterClassW(&wc)) { return 0; } //hMenu = LoadMenuW(hInstance, MAKEINTRESOURCE(IDR_MENU1)); // Create main application window HWND hWndApp = CreateDialogParamW( NULL, MAKEINTRESOURCE(IDD_APP), NULL, (DLGPROC)CFaceBasics::MessageRouter, reinterpret_cast<LPARAM>(this)); //HWND hWndApp = CreateDialogParamW( NULL, MAKEINTRESOURCE(IDD_APP), NULL, (DLGPROC)CFaceBasics::MessageRouter, WS_CAPTION); // Show window ShowWindow(hWndApp, nCmdShow); //ShowWindow(hWndApp, 3); // Main message loop while (WM_QUIT != msg.message) { Update(); while (PeekMessageW(&msg, NULL, 0, 0, PM_REMOVE)) { // If a dialog message will be taken care of by the dialog proc if (hWndApp && IsDialogMessageW(hWndApp, &msg)) { continue; } TranslateMessage(&msg); DispatchMessageW(&msg); } } return static_cast<int>(msg.wParam); }
void UGameWindow::ShowCursor(bool bVisible) { static const auto defaultCursor = LoadCursorW(nullptr, IDC_ARROW); if (bVisible) { SetCursor(defaultCursor); } else { SetCursor(nullptr); } }
int _glfwPlatformCreateStandardCursor(_GLFWcursor* cursor, int shape) { cursor->win32.handle = CopyCursor(LoadCursorW(NULL, translateCursorShape(shape))); if (!cursor->win32.handle) { _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to create standard cursor"); return GL_FALSE; } return GL_TRUE; }
int CALLBACK WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR, int) { timeBeginPeriod(1); WNDCLASSW wc; ZeroMemory(&wc, sizeof(wc)); wc.lpfnWndProc = WndProc; wc.hInstance = hInstance; wc.hbrBackground = CreateSolidBrush(RGB(0, 0, 0)); wc.hCursor = LoadCursorW(0, MAKEINTRESOURCE(IDC_ARROW)); wc.lpszClassName = L"LatencyTest"; RegisterClassW(&wc); HWND mainWindow = CreateWindowW( L"LatencyTest", L"Input Latency Test", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, hInstance, 0); ShowWindow(mainWindow, SW_SHOW); UpdateWindow(mainWindow); green = CreateSolidBrush(RGB(0, 255, 0)); red = CreateSolidBrush(RGB(255, 0, 0)); timeSetEvent( 16, 0, postSimulate, (DWORD_PTR)mainWindow, TIME_PERIODIC); MSG msg; for (;;) { BOOL b = GetMessageW(&msg, 0, 0, 0); if (b == -1) { return -1; } if (b == 0) { return msg.wParam; } TranslateMessage(&msg); DispatchMessageW(&msg); } }
/*********************************************************************** * SYSLINK_Register [Internal] * * Registers the SysLink window class. */ VOID SYSLINK_Register (void) { WNDCLASSW wndClass; ZeroMemory (&wndClass, sizeof(wndClass)); wndClass.style = CS_GLOBALCLASS | CS_VREDRAW | CS_HREDRAW; wndClass.lpfnWndProc = SysLinkWindowProc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = sizeof (SYSLINK_INFO *); wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_ARROW); wndClass.lpszClassName = WC_LINK; RegisterClassW (&wndClass); }
/*********************************************************************** * PROGRESS_Register [Internal] * * Registers the progress bar window class. */ VOID PROGRESS_Register (void) { WNDCLASSW wndClass; ZeroMemory (&wndClass, sizeof(wndClass)); wndClass.style = CS_GLOBALCLASS | CS_VREDRAW | CS_HREDRAW; wndClass.lpfnWndProc = (WNDPROC)ProgressWindowProc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = sizeof (PROGRESS_INFO *); wndClass.hCursor = LoadCursorW (0, IDC_ARROWW); wndClass.lpszClassName = PROGRESS_CLASSW; RegisterClassW (&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); }
/*********************************************************************** * UPDOWN_Register [Internal] * * Registers the updown window class. */ void UPDOWN_Register(void) { WNDCLASSW wndClass; ZeroMemory( &wndClass, sizeof( WNDCLASSW ) ); wndClass.style = CS_GLOBALCLASS | CS_VREDRAW | CS_HREDRAW; wndClass.lpfnWndProc = UpDownWindowProc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = sizeof(UPDOWN_INFO*); wndClass.hCursor = LoadCursorW( 0, (LPWSTR)IDC_ARROW ); wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); wndClass.lpszClassName = UPDOWN_CLASSW; RegisterClassW( &wndClass ); }
void ANIMATE_Register(void) { WNDCLASSW wndClass; ZeroMemory(&wndClass, sizeof(WNDCLASSW)); wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS; wndClass.lpfnWndProc = ANIMATE_WindowProc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = sizeof(ANIMATE_INFO *); wndClass.hCursor = LoadCursorW(0, (LPCWSTR)IDC_ARROW); wndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); wndClass.lpszClassName = ANIMATE_CLASSW; RegisterClassW(&wndClass); }
void IPADDRESS_Register (void) { WNDCLASSW wndClass; ZeroMemory (&wndClass, sizeof(WNDCLASSW)); wndClass.style = CS_GLOBALCLASS | CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW; wndClass.lpfnWndProc = IPADDRESS_WindowProc; wndClass.cbClsExtra = 0; wndClass.cbWndExtra = sizeof(IPADDRESS_INFO *); wndClass.hCursor = LoadCursorW (0, (LPWSTR)IDC_IBEAM); wndClass.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); wndClass.lpszClassName = WC_IPADDRESSW; RegisterClassW (&wndClass); }
void makeTableWindowClass(void) { WNDCLASSW wc; ZeroMemory(&wc, sizeof (WNDCLASSW)); wc.lpszClassName = tableWindowClass; wc.lpfnWndProc = tableWndProc; wc.hCursor = LoadCursorW(NULL, IDC_ARROW); wc.hIcon = LoadIconW(NULL, IDI_APPLICATION); wc.hbrBackground = (HBRUSH) (COLOR_WINDOW + 1); // TODO correct? wc.style = CS_HREDRAW | CS_VREDRAW; wc.hInstance = GetModuleHandle(NULL); if (RegisterClassW(&wc) == 0) abort(); }
/// <summary> /// Creates the main window and begins processing /// </summary> /// <param name="hInstance">handle to the application instance</param> /// <param name="nCmdShow">whether to display minimized, maximized, or normally</param> int CKinectFusionExplorer::Run(HINSTANCE hInstance, int nCmdShow) { MSG msg = {0}; WNDCLASS wc = {0}; // Dialog custom window class wc.style = CS_HREDRAW | CS_VREDRAW; wc.cbWndExtra = DLGWINDOWEXTRA; wc.hInstance = hInstance; wc.hCursor = LoadCursorW(nullptr, IDC_ARROW); wc.hIcon = LoadIconW(hInstance, MAKEINTRESOURCE(IDI_APP)); wc.lpfnWndProc = DefDlgProcW; wc.lpszClassName = L"KinectFusionExplorerAppDlgWndClass"; if (!RegisterClassW(&wc)) { return 0; } // Create main application window HWND hWndApp = CreateDialogParamW( hInstance, MAKEINTRESOURCE(IDD_APP), nullptr, (DLGPROC)CKinectFusionExplorer::MessageRouter, reinterpret_cast<LPARAM>(this)); // Show window ShowWindow(hWndApp, nCmdShow); // Main message loop while (WM_QUIT != msg.message) { if (GetMessage(&msg, nullptr, 0, 0)) { // If a dialog message will be taken care of by the dialog proc if ((hWndApp != nullptr) && IsDialogMessageW(hWndApp, &msg)) { continue; } TranslateMessage(&msg); DispatchMessageW(&msg); } } return static_cast<int>(msg.wParam); }