static void LoadCoreModule(void) { INITCOMMONCONTROLSEX icce = {0}; icce.dwSize = sizeof(icce); icce.dwICC = ICC_WIN95_CLASSES | ICC_USEREX_CLASSES; InitCommonControlsEx(&icce); hAPCWindow = CreateWindowEx(0, _T("ComboLBox"), NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL); SetClassLongPtr(hAPCWindow, GCL_STYLE, GetClassLongPtr(hAPCWindow, GCL_STYLE) | CS_DROPSHADOW); DestroyWindow(hAPCWindow); hAPCWindow = NULL; hAPCWindow = CreateWindowEx(0, _T("STATIC"), NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL); SetWindowLongPtr(hAPCWindow, GWLP_WNDPROC, (LONG_PTR)APCWndProc); SetTimer(hAPCWindow, 1, 1000, NULL); hStackMutex = CreateMutex(NULL, FALSE, NULL); hThreadQueueEmpty = CreateEvent(NULL, TRUE, TRUE, NULL); #ifdef _WIN64 HMODULE mirInst = GetModuleHandleA("miranda64.exe"); #else HMODULE mirInst = GetModuleHandleA("miranda32.exe"); #endif RecalculateTime = (void (*)()) GetProcAddress(mirInst, "RecalculateTime"); InitWinver(); InitPathUtils(); InitLogs(); InitialiseModularEngine(); InitProtocols(); InitMetaContacts(); }
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd) { WNDCLASSEXW WndClass = {0}; WCHAR szWindowClass[] = L"ROSAPPMGR"; WCHAR szWindowName[MAX_STR_LEN]; WCHAR szErrorText[MAX_STR_LEN]; HANDLE hMutex = NULL; MSG Msg; switch (GetUserDefaultUILanguage()) { case MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT): SetProcessDefaultLayout(LAYOUT_RTL); break; default: break; } hInst = hInstance; if (!IsUserAnAdmin()) { LoadStringW(hInst, IDS_USER_NOT_ADMIN, szErrorText, sizeof(szErrorText) / sizeof(WCHAR)); MessageBox(0, szErrorText, NULL, MB_OK | MB_ICONWARNING); return 1; } hMutex = CreateMutexW(NULL, FALSE, szWindowClass); if ((!hMutex) || (GetLastError() == ERROR_ALREADY_EXISTS)) { /* If already started, it is found its window */ HWND hWindow = FindWindowW(szWindowClass, NULL); /* Activate window */ ShowWindow(hWindow, SW_SHOWNORMAL); SetForegroundWindow(hWindow); return 1; } if (!LoadSettings()) { FillDefaultSettings(&SettingsInfo); } InitLogs(); InitCommonControls(); /* Create the window */ WndClass.cbSize = sizeof(WNDCLASSEXW); WndClass.lpszClassName = szWindowClass; WndClass.lpfnWndProc = MainWindowProc; WndClass.hInstance = hInstance; WndClass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MAIN)); WndClass.hCursor = LoadCursor(NULL, IDC_ARROW); WndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); WndClass.lpszMenuName = MAKEINTRESOURCEW(IDR_MAINMENU); if (RegisterClassExW(&WndClass) == (ATOM)0) goto Exit; LoadStringW(hInst, IDS_APPTITLE, szWindowName, sizeof(szWindowName) / sizeof(WCHAR)); hMainWnd = CreateWindowExW(WS_EX_WINDOWEDGE, szWindowClass, szWindowName, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, CW_USEDEFAULT, CW_USEDEFAULT, 680, 450, NULL, NULL, hInstance, NULL); if (!hMainWnd) goto Exit; /* Show it */ ShowWindow(hMainWnd, SW_SHOW); UpdateWindow(hMainWnd); /* Message Loop */ while (GetMessage(&Msg, NULL, 0, 0)) { TranslateMessage(&Msg); DispatchMessage(&Msg); } Exit: if (hMutex) CloseHandle(hMutex); return 0; }
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd) { WCHAR szWindowClass[] = L"ROSAPPMGR"; HANDLE hMutex = NULL; HACCEL KeyBrd; MSG Msg; InitializeAtlModule(hInstance, TRUE); switch (GetUserDefaultUILanguage()) { case MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT): SetProcessDefaultLayout(LAYOUT_RTL); break; default: break; } hInst = hInstance; hMutex = CreateMutexW(NULL, FALSE, szWindowClass); if ((!hMutex) || (GetLastError() == ERROR_ALREADY_EXISTS)) { /* If already started, it is found its window */ HWND hWindow = FindWindowW(szWindowClass, NULL); /* Activate window */ ShowWindow(hWindow, SW_SHOWNORMAL); SetForegroundWindow(hWindow); return 1; } if (!LoadSettings()) { FillDefaultSettings(&SettingsInfo); } InitLogs(); InitCommonControls(); hMainWnd = CreateMainWindow(); if (!hMainWnd) goto Exit; /* Maximize it if we must */ ShowWindow(hMainWnd, (SettingsInfo.bSaveWndPos && SettingsInfo.Maximized ? SW_MAXIMIZE : nShowCmd)); UpdateWindow(hMainWnd); if (SettingsInfo.bUpdateAtStart) UpdateAppsDB(); /* Load the menu hotkeys */ KeyBrd = LoadAccelerators(NULL, MAKEINTRESOURCE(HOTKEYS)); /* Message Loop */ while (GetMessage(&Msg, NULL, 0, 0)) { if (!TranslateAccelerator(hMainWnd, KeyBrd, &Msg)) { TranslateMessage(&Msg); DispatchMessage(&Msg); } } Exit: if (hMutex) CloseHandle(hMutex); InitializeAtlModule(hInstance, FALSE); return 0; }
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nShowCmd) { WNDCLASSEXW WndClass = {0}; WCHAR szWindowClass[] = L"ROSAPPMGR"; WCHAR szWindowName[MAX_STR_LEN]; HANDLE hMutex = NULL; HACCEL KeyBrd; MSG Msg; switch (GetUserDefaultUILanguage()) { case MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT): SetProcessDefaultLayout(LAYOUT_RTL); break; default: break; } hInst = hInstance; hMutex = CreateMutexW(NULL, FALSE, szWindowClass); if ((!hMutex) || (GetLastError() == ERROR_ALREADY_EXISTS)) { /* If already started, it is found its window */ HWND hWindow = FindWindowW(szWindowClass, NULL); /* Activate window */ ShowWindow(hWindow, SW_SHOWNORMAL); SetForegroundWindow(hWindow); return 1; } if (!LoadSettings()) { FillDefaultSettings(&SettingsInfo); } InitLogs(); InitCommonControls(); /* Create the window */ WndClass.cbSize = sizeof(WNDCLASSEXW); WndClass.lpszClassName = szWindowClass; WndClass.lpfnWndProc = MainWindowProc; WndClass.hInstance = hInstance; WndClass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MAIN)); WndClass.hCursor = LoadCursor(NULL, IDC_ARROW); WndClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); WndClass.lpszMenuName = MAKEINTRESOURCEW(IDR_MAINMENU); if (RegisterClassExW(&WndClass) == (ATOM)0) goto Exit; LoadStringW(hInst, IDS_APPTITLE, szWindowName, _countof(szWindowName)); hMainWnd = CreateWindowExW(WS_EX_WINDOWEDGE, szWindowClass, szWindowName, WS_OVERLAPPEDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, (SettingsInfo.bSaveWndPos ? SettingsInfo.Left : CW_USEDEFAULT), (SettingsInfo.bSaveWndPos ? SettingsInfo.Top : CW_USEDEFAULT), (SettingsInfo.bSaveWndPos ? SettingsInfo.Width : 680), (SettingsInfo.bSaveWndPos ? SettingsInfo.Height : 450), NULL, NULL, hInstance, NULL); if (!hMainWnd) goto Exit; /* Maximize it if we must */ ShowWindow(hMainWnd, (SettingsInfo.bSaveWndPos && SettingsInfo.Maximized ? SW_MAXIMIZE : nShowCmd)); UpdateWindow(hMainWnd); if (SettingsInfo.bUpdateAtStart) UpdateAppsDB(); /* Load the menu hotkeys */ KeyBrd = LoadAccelerators(NULL, MAKEINTRESOURCE(HOTKEYS)); /* Message Loop */ while (GetMessage(&Msg, NULL, 0, 0)) { if (!TranslateAccelerator(hMainWnd, KeyBrd, &Msg)) { TranslateMessage(&Msg); DispatchMessage(&Msg); } } Exit: if (hMutex) CloseHandle(hMutex); return 0; }