int APIENTRY WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow) { MSG msg; HANDLE hAccelTable; if(!hPrevInst) { if(!InitApplication(hInst)) return FALSE; } if(!InitInstance(hInst, nCmdShow)) return FALSE; hAccelTable = LoadAcceleratorsW(hInst, MAKEINTRESOURCEW(IDA_OLEVIEW)); while(GetMessageW(&msg, NULL, 0, 0)) { if(TranslateAcceleratorW(globals.hMainWnd, hAccelTable, &msg)) continue; TranslateMessage(&msg); DispatchMessageW(&msg); } return msg.wParam; }
static void hugsprim_LoadAcceleratorsW_0(HugsStackPtr hugs_root) { HsPtr arg1; HsPtr arg2; HsPtr res1; arg1 = hugs->getPtr(); arg2 = hugs->getPtr(); res1 = LoadAcceleratorsW(arg1, arg2); hugs->putPtr(res1); hugs->returnIO(hugs_root,1); }
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) { MSG msg; HACCEL hAccel; UNREFERENCED_PARAMETER(hPrevInstance); if (ProcessCmdLine(lpCmdLine)) { return 0; } /* Initialize global strings */ LoadStringW(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); LoadStringW(hInstance, IDC_REGEDIT_FRAME, szFrameClass, MAX_LOADSTRING); LoadStringW(hInstance, IDC_REGEDIT, szChildClass, MAX_LOADSTRING); switch (GetUserDefaultUILanguage()) { case MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT): SetProcessDefaultLayout(LAYOUT_RTL); break; default: break; } /* Store instance handle in our global variable */ hInst = hInstance; /* Perform application initialization */ if (!InitInstance(hInstance, nCmdShow)) { return 0; } hAccel = LoadAcceleratorsW(hInstance, MAKEINTRESOURCEW(ID_ACCEL)); /* Main message loop */ while (GetMessageW(&msg, NULL, 0, 0)) { if (!TranslateAcceleratorW(hFrameWnd, hAccel, &msg) && !TranslateChildTabMessage(&msg)) { TranslateMessage(&msg); DispatchMessageW(&msg); } } ExitInstance(hInstance); return (int)msg.wParam; }
int WINAPI wWinMain( HINSTANCE hInst, HINSTANCE hPrevInst, LPWSTR cmdline, int cmdshow ) { MSG msg; WNDCLASSEXW wc; HWND hWnd; HACCEL haccel; WCHAR appname[20]; LoadStringW( hInst, IDS_APPNAME, appname, sizeof(appname)/sizeof(WCHAR)); wc.cbSize = sizeof(wc); wc.style = 0; wc.lpfnWndProc = MainProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInst; wc.hIcon = LoadIconW( hInst, MAKEINTRESOURCEW(IDI_WINEMINE) ); wc.hCursor = LoadCursorW( 0, (LPWSTR)IDI_APPLICATION ); wc.hbrBackground = GetStockObject( BLACK_BRUSH ); wc.lpszMenuName = MAKEINTRESOURCEW(IDM_WINEMINE); wc.lpszClassName = appname; wc.hIconSm = LoadImageW( hInst, MAKEINTRESOURCEW(IDI_WINEMINE), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), LR_SHARED ); if (!RegisterClassExW(&wc)) ExitProcess(1); hWnd = CreateWindowW( appname, appname, wnd_style, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, hInst, NULL ); if (!hWnd) ExitProcess(1); ShowWindow( hWnd, cmdshow ); UpdateWindow( hWnd ); haccel = LoadAcceleratorsW( hInst, MAKEINTRESOURCEW(IDA_WINEMINE) ); SetTimer( hWnd, ID_TIMER, 1000, NULL ); while( GetMessageW(&msg, 0, 0, 0) ) { if (!TranslateAcceleratorW( hWnd, haccel, &msg )) TranslateMessage( &msg ); DispatchMessageW( &msg ); } return msg.wParam; }
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { MSG msg; HACCEL hAccel; if (ProcessCmdLine(lpCmdLine)) { return 0; } /* Initialize global strings */ LoadStringW(hInstance, IDS_APP_TITLE, szTitle, COUNT_OF(szTitle)); LoadStringW(hInstance, IDS_REGISTRY_DEFAULT_VALUE, g_pszDefaultValueName, COUNT_OF(g_pszDefaultValueName)); /* Store instance handle in our global variable */ hInst = hInstance; /* Perform application initialization */ if (!InitInstance(hInstance, nCmdShow)) { return FALSE; } hAccel = LoadAcceleratorsW(hInstance, MAKEINTRESOURCEW(IDC_REGEDIT)); /* Main message loop */ while (GetMessageW(&msg, NULL, 0, 0)) { if (!TranslateAcceleratorW(hFrameWnd, hAccel, &msg) && !TranslateChildTabMessage(&msg)) { TranslateMessage(&msg); DispatchMessageW(&msg); } } ExitInstance(); return msg.wParam; }
INT WINAPI wWinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, INT nCmdShow) { g_hInstance = hInstance; InitCommonControls(); HACCEL hAccel = LoadAcceleratorsW(hInstance, MAKEINTRESOURCEW(1)); LoadStringW(hInstance, IDS_TITLE, g_szTitle, _countof(g_szTitle)); LoadStringW(hInstance, IDS_FONTNAME, g_szNameHead, _countof(g_szNameHead)); LoadStringW(hInstance, IDS_SUBSTITUTE, g_szSubstituteHead, _countof(g_szSubstituteHead)); WNDCLASSW wc = {0}; wc.style = 0; wc.lpfnWndProc = WindowProc; wc.hInstance = hInstance; g_hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(1)); wc.hIcon = g_hIcon; wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)(COLOR_3DFACE + 1); wc.lpszMenuName = MAKEINTRESOURCEW(1); wc.lpszClassName = g_pszClassName; if (!RegisterClassW(&wc)) { MessageBoxA(NULL, "ERROR: RegisterClass failed.", NULL, MB_ICONERROR); return 1; } const DWORD dwStyle = WS_OVERLAPPEDWINDOW; INT Width = NAME_COLUMN_WIDTH + SUB_COLUMN_WIDTH + GetSystemMetrics(SM_CXVSCROLL) + GetSystemMetrics(SM_CXSIZEFRAME); INT Height = 320; RECT Rect = { 0, 0, Width, Height }; AdjustWindowRect(&Rect, dwStyle, TRUE); Width = Rect.right - Rect.left; Height = Rect.bottom - Rect.top; g_hMainWnd = CreateWindowW(g_pszClassName, g_szTitle, dwStyle, CW_USEDEFAULT, CW_USEDEFAULT, Width, Height, NULL, NULL, hInstance, NULL); if (g_hMainWnd == NULL) { MessageBoxA(NULL, "ERROR: CreateWindow failed.", NULL, MB_ICONERROR); return 2; } ShowWindow(g_hMainWnd, nCmdShow); UpdateWindow(g_hMainWnd); MSG msg; while (GetMessage(&msg, NULL, 0, 0)) { if (TranslateAccelerator(g_hMainWnd, hAccel, &msg)) continue; TranslateMessage(&msg); DispatchMessage(&msg); } return (INT)msg.wParam; }
INT WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, INT nCmdShow) { MSG msg; INITCOMMONCONTROLSEX icex; /* * Set our shutdown parameters: we want to shutdown the very last, * but before any TaskMgr instance (which has a shutdown level of 1). */ SetProcessShutdownParameters(2, 0); Globals.hInstance = hInstance; Globals.hGroups = NULL; Globals.hActiveGroup = NULL; /* Load Program Manager's settings */ MAIN_LoadSettings(); /* Load the default icons */ Globals.hDefaultIcon = LoadIconW(NULL, MAKEINTRESOURCEW(IDI_WINLOGO)); Globals.hMainIcon = LoadIconW(Globals.hInstance, MAKEINTRESOURCEW(IDI_APPICON)); Globals.hPersonalGroupIcon = LoadIconW(Globals.hInstance, MAKEINTRESOURCEW(IDI_GROUP_PERSONAL_ICON)); Globals.hCommonGroupIcon = LoadIconW(Globals.hInstance, MAKEINTRESOURCEW(IDI_GROUP_COMMON_ICON)); /* Initialize the common controls */ icex.dwSize = sizeof(icex); icex.dwICC = ICC_HOTKEY_CLASS | ICC_LISTVIEW_CLASSES; // | ICC_STANDARD_CLASSES; InitCommonControlsEx(&icex); /* Register the window classes */ if (!hPrevInstance) // FIXME: Unused on Win32! { if (!MAIN_RegisterMainWinClass()) goto Quit; if (!GROUP_RegisterGroupWinClass()) goto Quit; } /* Set up the strings, the main window, the accelerators, the menu, and the MDI child window */ STRING_LoadStrings(); MAIN_CreateMainWindow(); Globals.hAccel = LoadAcceleratorsW(Globals.hInstance, MAKEINTRESOURCEW(IDA_ACCEL)); STRING_LoadMenus(); MAIN_CreateMDIWindow(); /* Load all the groups */ // MAIN_CreateGroups(); MAIN_LoadGroups(); /* Load the Startup group: start the initial applications */ MAIN_AutoStart(); /* Message loop */ while (GetMessageW(&msg, NULL, 0, 0)) { if (!TranslateMDISysAccel(Globals.hMDIWnd, &msg) && !TranslateAcceleratorW(Globals.hMainWnd, Globals.hAccel, &msg)) { TranslateMessage(&msg); DispatchMessageW(&msg); } } Quit: /* Save the settings, close the registry keys and quit */ // MAIN_SaveSettings(); RegCloseKey(Globals.hKeyCommonGroups); RegCloseKey(Globals.hKeyUnicodeGroups); RegCloseKey(Globals.hKeyAnsiGroups); RegCloseKey(Globals.hKeyPMUnicodeGroups); RegCloseKey(Globals.hKeyPMAnsiGroups); RegCloseKey(Globals.hKeyPMCommonGroups); RegCloseKey(Globals.hKeyPMSettings); RegCloseKey(Globals.hKeyProgMan); return 0; }
int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { MSG msg; HACCEL hAccelTable; UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); UNREFERENCED_PARAMETER(nCmdShow); /* * Initialize this instance of MSConfig. Quit if we have * another instance already running. */ if (!Initialize(hInstance)) return -1; // hInst = hInstance; hMainWnd = CreatePropSheet(hInstance, NULL, szAppName); if (!hMainWnd) { /* We failed, cleanup and bail out */ Cleanup(); return -1; } hAccelTable = LoadAcceleratorsW(hInstance, MAKEINTRESOURCEW(IDR_MSCONFIG)); /* Message loop */ while (IsWindow(hMainWnd) && GetMessageW(&msg, NULL, 0, 0)) { /* * PropSheet_GetCurrentPageHwnd returns NULL when the user clicks the OK or Cancel button * and after all of the pages have been notified. Apply button doesn't cause this to happen. * We can then use the DestroyWindow function to destroy the property sheet. */ if (PropSheet_GetCurrentPageHwnd(hMainWnd) == NULL) break; /* Process the accelerator table */ if (!TranslateAcceleratorW(hMainWnd, hAccelTable, &msg)) { /* * If e.g. an item on the tree view is being edited, * we cannot pass the event to PropSheet_IsDialogMessage. * Doing so causes the property sheet to be closed at Enter press * (instead of completing edit operation). */ if (/*g_bDisableDialogDispatch ||*/ !PropSheet_IsDialogMessage(hMainWnd, &msg)) { TranslateMessage(&msg); DispatchMessageW(&msg); } } } // FIXME: Process the results of MSConfig !! /* Destroy the accelerator table and the window */ if (hAccelTable != NULL) DestroyAcceleratorTable(hAccelTable); DestroyWindow(hMainWnd); /* Finish cleanup and return */ Cleanup(); return (int)msg.wParam; }
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) { MSG msg; HACCEL hAccel; HWND hPrevWindow; WNDCLASSEXW wndclass; WCHAR szBuffer[MAX_STRING_LEN]; hPrevWindow = FindWindowW(szClassName, NULL); if (hPrevWindow) { BringWindowToFront(hPrevWindow); return 0; } switch (GetUserDefaultUILanguage()) { case MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT): SetProcessDefaultLayout(LAYOUT_RTL); break; default: break; } ZeroMemory(&Globals, sizeof(Globals)); Globals.hInstance = hInstance; ZeroMemory(&wndclass, sizeof(wndclass)); wndclass.cbSize = sizeof(wndclass); wndclass.lpfnWndProc = MainWndProc; wndclass.hInstance = hInstance; wndclass.hIcon = LoadIconW(hInstance, MAKEINTRESOURCEW(CLIPBRD_ICON)); wndclass.hCursor = LoadCursorW(0, IDC_ARROW); wndclass.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1); wndclass.lpszMenuName = MAKEINTRESOURCEW(MAIN_MENU); wndclass.lpszClassName = szClassName; if (!RegisterClassExW(&wndclass)) { ShowLastWin32Error(NULL); return 0; } ZeroMemory(&Scrollstate, sizeof(Scrollstate)); LoadStringW(hInstance, STRING_CLIPBOARD, szBuffer, ARRAYSIZE(szBuffer)); Globals.hMainWnd = CreateWindowExW(WS_EX_CLIENTEDGE | WS_EX_ACCEPTFILES, szClassName, szBuffer, WS_OVERLAPPEDWINDOW | WS_HSCROLL | WS_VSCROLL, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, Globals.hInstance, NULL); if (!Globals.hMainWnd) { ShowLastWin32Error(NULL); return 0; } ShowWindow(Globals.hMainWnd, nCmdShow); UpdateWindow(Globals.hMainWnd); hAccel = LoadAcceleratorsW(Globals.hInstance, MAKEINTRESOURCEW(ID_ACCEL)); if (!hAccel) { ShowLastWin32Error(Globals.hMainWnd); } /* If the user provided a path to a clipboard data file, try to open it */ if (__argc >= 2) LoadClipboardDataFromFile(__wargv[1]); while (GetMessageW(&msg, 0, 0, 0)) { if (!TranslateAcceleratorW(Globals.hMainWnd, hAccel, &msg)) { TranslateMessage(&msg); DispatchMessageW(&msg); } } return (int)msg.wParam; }