diff --git a/wCenterWindow/wCenterWindow.cpp b/wCenterWindow/wCenterWindow.cpp index 668d3c5..b605bb9 100644 --- a/wCenterWindow/wCenterWindow.cpp +++ b/wCenterWindow/wCenterWindow.cpp @@ -50,20 +50,6 @@ INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM); -ATOM MyRegisterClass(HINSTANCE hInstance) -{ - WNDCLASSEX wcex = { 0 }; - wcex.cbSize = sizeof(WNDCLASSEX); - wcex.lpfnWndProc = WndProc; - wcex.hInstance = hInstance; - wcex.hIcon = LoadIconW(hInstance, MAKEINTRESOURCE(IDI_TRAYICON)); - wcex.hCursor = LoadCursorW(nullptr, IDC_ARROW); - wcex.lpszClassName = szClass; - wcex.hIconSm = wcex.hIcon; - hIcon = wcex.hIcon; - return RegisterClassExW(&wcex); -} - VOID MoveWindowToMonitorCenter(HWND hwnd, BOOL bWorkArea, BOOL bResize) { diag_log(L"Entering MoveWindowToMonitorCenter(): hwnd =", hwnd, L"Title:", (LPWSTR)szBuffer); @@ -112,6 +98,20 @@ VOID MoveWindowToMonitorCenter(HWND hwnd, BOOL bWorkArea, BOOL bResize) } +ATOM MyRegisterClass(HINSTANCE hInstance) +{ + WNDCLASSEX wcex = { 0 }; + wcex.cbSize = sizeof(WNDCLASSEX); + wcex.lpfnWndProc = WndProc; + wcex.hInstance = hInstance; + wcex.hIcon = LoadIconW(hInstance, MAKEINTRESOURCE(IDI_TRAYICON)); + wcex.hCursor = LoadCursorW(nullptr, IDC_ARROW); + wcex.lpszClassName = szClass; + wcex.hIconSm = wcex.hIcon; + hIcon = wcex.hIcon; + return RegisterClassExW(&wcex); +} + int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow) { @@ -218,8 +218,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) bWorkArea ? mii.fState = MFS_CHECKED : mii.fState = MFS_UNCHECKED; SetMenuItemInfoW(hPopup, ID_POPUPMENU_AREA, FALSE, &mii); - //nid.cbSize = sizeof(NOTIFYICONDATA); - nid.cbSize = NOTIFYICONDATA_V3_SIZE; + nid.cbSize = sizeof(NOTIFYICONDATA); nid.hWnd = hWnd; nid.uVersion = NOTIFYICON_VERSION; nid.uCallbackMessage = WM_WCW; diff --git a/wCenterWindow/wCenterWindow.manifest b/wCenterWindow/wCenterWindow.manifest index 8f78103..451857b 100644 --- a/wCenterWindow/wCenterWindow.manifest +++ b/wCenterWindow/wCenterWindow.manifest @@ -1,5 +1,42 @@ + + Centers windows by hotkey (C++) + + + + + + + + + + + + + + + + + + + + + + + + + @@ -7,15 +44,5 @@ - - - - - + diff --git a/wCenterWindow/wCenterWindow.vcxproj b/wCenterWindow/wCenterWindow.vcxproj index 732dbfd..2a6a996 100644 --- a/wCenterWindow/wCenterWindow.vcxproj +++ b/wCenterWindow/wCenterWindow.vcxproj @@ -95,7 +95,7 @@ Windows true - comctl32.lib;shell32.lib;%(AdditionalDependencies) + comctl32.lib;%(AdditionalDependencies) $(ProjectName).manifest %(AdditionalManifestFiles) @@ -117,7 +117,7 @@ true true false - comctl32.lib;shell32.lib;%(AdditionalDependencies) + comctl32.lib;%(AdditionalDependencies) $(ProjectName).manifest %(AdditionalManifestFiles) @@ -134,7 +134,7 @@ Windows true - comctl32.lib;shell32.lib;%(AdditionalDependencies) + comctl32.lib;%(AdditionalDependencies) @@ -146,13 +146,14 @@ NDEBUG;_WINDOWS;%(PreprocessorDefinitions) true stdcpp17 + MultiThreaded Windows true true true - comctl32.lib;shell32.lib;%(AdditionalDependencies) + comctl32.lib;%(AdditionalDependencies)