|
|
|
|
@@ -1,4 +1,4 @@
|
|
|
|
|
// wCenterWindow, v2.3.2
|
|
|
|
|
// wCenterWindow, v2.3.3
|
|
|
|
|
//
|
|
|
|
|
// TODO: More verbose logs - partially done.
|
|
|
|
|
// TODO: More verbose error messages
|
|
|
|
|
@@ -55,7 +55,8 @@ INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM);
|
|
|
|
|
|
|
|
|
|
VOID MoveWindowToMonitorCenter(HWND hwnd, BOOL bWorkArea, BOOL bResize)
|
|
|
|
|
{
|
|
|
|
|
diag_log(L"Entering MoveWindowToMonitorCenter(): hwnd =", hwnd, L"Title:", (LPWSTR)szBuffer);
|
|
|
|
|
//diag_log(L"Entering MoveWindowToMonitorCenter(): hwnd =", hwnd, L"Title:", (LPWSTR)szBuffer);
|
|
|
|
|
diag_log(L"Entering MoveWindowToMonitorCenter(): hwnd =", hwnd);
|
|
|
|
|
|
|
|
|
|
RECT fgwrc = { 0 };
|
|
|
|
|
GetWindowRect(hwnd, &fgwrc);
|
|
|
|
|
@@ -136,7 +137,7 @@ int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmd
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MyRegisterClass(hInstance);
|
|
|
|
|
hWnd = CreateWindowExW(0, szClass, szTitle, 0, 0, 0, 0, 0, NULL, NULL, hInstance, NULL);
|
|
|
|
|
hWnd = CreateWindowExW(0, szClass, szTitle, 0, 0, 0, 0, 0, HWND_MESSAGE, NULL, hInstance, NULL);
|
|
|
|
|
if (!hWnd)
|
|
|
|
|
{
|
|
|
|
|
ShowError(IDS_ERR_WND);
|
|
|
|
|
@@ -146,8 +147,8 @@ int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmd
|
|
|
|
|
int nArgs = 0;
|
|
|
|
|
LPWSTR* szArglist = CommandLineToArgvW(GetCommandLineW(), &nArgs);
|
|
|
|
|
|
|
|
|
|
diag_log(L"Arguments:", nArgs);
|
|
|
|
|
for (int i = 0; i < nArgs; i++)
|
|
|
|
|
diag_log(L"Arguments:", nArgs - 1);
|
|
|
|
|
for (int i = 1; i < nArgs; i++)
|
|
|
|
|
{
|
|
|
|
|
diag_log(L"Argument", i, L":", szArglist[i]);
|
|
|
|
|
}
|
|
|
|
|
@@ -221,10 +222,8 @@ 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(NOTIFYICONDATAW);
|
|
|
|
|
nid.cbSize = sizeof(nid);
|
|
|
|
|
nid.cbSize = sizeof(NOTIFYICONDATAW);
|
|
|
|
|
nid.hWnd = hWnd;
|
|
|
|
|
//nid.uVersion = NOTIFYICON_VERSION_4;
|
|
|
|
|
nid.uVersion = NOTIFYICON_VERSION;
|
|
|
|
|
nid.uCallbackMessage = WM_WCW;
|
|
|
|
|
nid.hIcon = hIcon;
|
|
|
|
|
@@ -233,8 +232,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
|
nid.dwInfoFlags = NIIF_NONE;
|
|
|
|
|
nid.dwState = NIS_HIDDEN;
|
|
|
|
|
nid.dwStateMask = NIS_HIDDEN;
|
|
|
|
|
//StringCchCopyW(nid.szTip, _countof(nid.szTip), szTitle);
|
|
|
|
|
StringCchCopyW(nid.szTip, ARRAYSIZE(nid.szTip), szTitle);
|
|
|
|
|
StringCchCopyW(nid.szTip, _countof(nid.szTip), szTitle);
|
|
|
|
|
|
|
|
|
|
hMouseHook = SetWindowsHookExW(WH_MOUSE_LL, MouseHookProc, hInst, NULL);
|
|
|
|
|
if (!hMouseHook)
|
|
|
|
|
@@ -255,8 +253,8 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
|
diag_log(L"Keyboard hook was successfully set");
|
|
|
|
|
|
|
|
|
|
LoadStringW(hInst, IDS_ABOUT, szAbout, _countof(szAbout));
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case WM_WCW:
|
|
|
|
|
{
|
|
|
|
|
@@ -287,14 +285,14 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
|
}
|
|
|
|
|
if (idMenu == ID_POPUPMENU_EXIT) SendMessageW(hWnd, WM_CLOSE, NULL, NULL);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case WM_DESTROY:
|
|
|
|
|
{
|
|
|
|
|
PostQuitMessage(0);
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return DefWindowProcW(hWnd, message, wParam, lParam);
|
|
|
|
|
@@ -362,7 +360,7 @@ LRESULT CALLBACK KeyboardHookProc(int nCode, WPARAM wParam, LPARAM lParam)
|
|
|
|
|
if (bApproved)
|
|
|
|
|
{
|
|
|
|
|
diag_log(L"Opening 'Manual editing' dialog");
|
|
|
|
|
DialogBoxW(hInst, MAKEINTRESOURCE(IDD_MANUAL_EDITING), hWnd, (DLGPROC)DlgProc);
|
|
|
|
|
DialogBoxW(hInst, MAKEINTRESOURCE(IDD_MANUAL_EDITING), hFgWnd, (DLGPROC)DlgProc);
|
|
|
|
|
SetForegroundWindow(hFgWnd);
|
|
|
|
|
}
|
|
|
|
|
else hFgWnd = NULL;
|
|
|
|
|
@@ -498,11 +496,7 @@ INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
|
case WM_NOTIFY:
|
|
|
|
|
{
|
|
|
|
|
LPNMHDR pNMHdr = (LPNMHDR)lParam;
|
|
|
|
|
switch (pNMHdr->code)
|
|
|
|
|
{
|
|
|
|
|
case NM_CLICK:
|
|
|
|
|
case NM_RETURN:
|
|
|
|
|
if (pNMHdr->idFrom == IDC_DONATIONLINK)
|
|
|
|
|
if ((NM_CLICK == pNMHdr->code || NM_RETURN == pNMHdr->code) && IDC_DONATIONLINK == pNMHdr->idFrom)
|
|
|
|
|
{
|
|
|
|
|
PNMLINK pNMLink = (PNMLINK)pNMHdr;
|
|
|
|
|
LITEM item = pNMLink->item;
|
|
|
|
|
@@ -512,8 +506,6 @@ INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case WM_COMMAND:
|
|
|
|
|
if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
|
|
|
|
|
@@ -521,8 +513,8 @@ INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|
|
|
|
EndDialog(hDlg, LOWORD(wParam));
|
|
|
|
|
diag_log(L"Closing 'About' dialog");
|
|
|
|
|
return (INT_PTR)TRUE;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
return (INT_PTR)FALSE;
|
|
|
|
|
}
|
|
|
|
|
|