More logging.
This commit is contained in:
@@ -51,7 +51,7 @@ void OpenLogFile()
|
|||||||
{
|
{
|
||||||
diag_log(L"Start logging");
|
diag_log(L"Start logging");
|
||||||
diag_log(L"Logfile:", log_path);
|
diag_log(L"Logfile:", log_path);
|
||||||
diag_log(L"Log-file was successfully opened");
|
diag_log(L"Logfile was successfully opened");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ VOID MoveWindowToMonitorCenter(HWND hwnd, BOOL bWorkArea, BOOL bResize)
|
|||||||
LONG nWidth = fgwrc.right - fgwrc.left;
|
LONG nWidth = fgwrc.right - fgwrc.left;
|
||||||
LONG nHeight = fgwrc.bottom - fgwrc.top;
|
LONG nHeight = fgwrc.bottom - fgwrc.top;
|
||||||
|
|
||||||
diag_log(L"Moving window from x =", fgwrc.left, L"y =", fgwrc.top);
|
diag_log(L"Moving window from x =", fgwrc.left, L", y =", fgwrc.top);
|
||||||
|
|
||||||
MONITORINFO mi = { 0 };
|
MONITORINFO mi = { 0 };
|
||||||
mi.cbSize = sizeof(MONITORINFO);
|
mi.cbSize = sizeof(MONITORINFO);
|
||||||
@@ -96,7 +96,7 @@ VOID MoveWindowToMonitorCenter(HWND hwnd, BOOL bWorkArea, BOOL bResize)
|
|||||||
MoveWindow(hwnd, x, y, nWidth, nHeight, TRUE);
|
MoveWindow(hwnd, x, y, nWidth, nHeight, TRUE);
|
||||||
SendMessageW(hwnd, WM_EXITSIZEMOVE, NULL, NULL);
|
SendMessageW(hwnd, WM_EXITSIZEMOVE, NULL, NULL);
|
||||||
|
|
||||||
diag_log(L"Moving window to x =", x, L"y =", y);
|
diag_log(L"Moving window to x =", x, L", y =", y);
|
||||||
diag_log(L"Quiting MoveWindowToMonitorCenter()");
|
diag_log(L"Quiting MoveWindowToMonitorCenter()");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,12 +118,6 @@ ATOM MyRegisterClass(HINSTANCE hInstance)
|
|||||||
|
|
||||||
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
|
int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
|
||||||
{
|
{
|
||||||
UNREFERENCED_PARAMETER(hPrevInstance);
|
|
||||||
UNREFERENCED_PARAMETER(lpCmdLine);
|
|
||||||
|
|
||||||
OpenLogFile();
|
|
||||||
diag_log(L"Entering WinMain()");
|
|
||||||
|
|
||||||
hInst = hInstance;
|
hInst = hInstance;
|
||||||
|
|
||||||
LoadStringW(hInstance, IDS_APP_TITLE, szTitle, _countof(szTitle));
|
LoadStringW(hInstance, IDS_APP_TITLE, szTitle, _countof(szTitle));
|
||||||
@@ -135,6 +129,9 @@ int APIENTRY wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmd
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OpenLogFile();
|
||||||
|
diag_log(L"Entering WinMain()");
|
||||||
|
|
||||||
MyRegisterClass(hInstance);
|
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, NULL, NULL, hInstance, NULL);
|
||||||
if (!hWnd)
|
if (!hWnd)
|
||||||
@@ -198,6 +195,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
{
|
{
|
||||||
case WM_CREATE:
|
case WM_CREATE:
|
||||||
{
|
{
|
||||||
|
diag_log(L"Recived WM_CREATE message");
|
||||||
hMenu = LoadMenuW(hInst, MAKEINTRESOURCE(IDR_MENU));
|
hMenu = LoadMenuW(hInst, MAKEINTRESOURCE(IDR_MENU));
|
||||||
if (!hMenu)
|
if (!hMenu)
|
||||||
{
|
{
|
||||||
@@ -259,17 +257,20 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
{
|
{
|
||||||
if (IDI_TRAYICON == wParam && (WM_RBUTTONDOWN == lParam || WM_LBUTTONDOWN == lParam))
|
if (IDI_TRAYICON == wParam && (WM_RBUTTONDOWN == lParam || WM_LBUTTONDOWN == lParam))
|
||||||
{
|
{
|
||||||
|
diag_log(L"Entering menu handler");
|
||||||
SetForegroundWindow(hWnd);
|
SetForegroundWindow(hWnd);
|
||||||
POINT pt;
|
POINT pt;
|
||||||
GetCursorPos(&pt);
|
GetCursorPos(&pt);
|
||||||
int idMenu = TrackPopupMenu(hPopup, TPM_RETURNCMD, pt.x, pt.y, 0, hWnd, NULL);
|
int idMenu = TrackPopupMenu(hPopup, TPM_RETURNCMD, pt.x, pt.y, 0, hWnd, NULL);
|
||||||
if (ID_POPUPMENU_ICON == idMenu)
|
if (ID_POPUPMENU_ICON == idMenu)
|
||||||
{
|
{
|
||||||
|
diag_log(L"Pressed 'Hide icon' menuitem");
|
||||||
bShowIcon = FALSE;
|
bShowIcon = FALSE;
|
||||||
HandlingTrayIcon();
|
HandlingTrayIcon();
|
||||||
}
|
}
|
||||||
if (ID_POPUPMENU_AREA == idMenu)
|
if (ID_POPUPMENU_AREA == idMenu)
|
||||||
{
|
{
|
||||||
|
diag_log(L"Pressed 'Use workarea' menuitem");
|
||||||
bWorkArea = !bWorkArea;
|
bWorkArea = !bWorkArea;
|
||||||
bWorkArea ? mii.fState = MFS_CHECKED : mii.fState = MFS_UNCHECKED;
|
bWorkArea ? mii.fState = MFS_CHECKED : mii.fState = MFS_UNCHECKED;
|
||||||
SetMenuItemInfoW(hPopup, ID_POPUPMENU_AREA, FALSE, &mii);
|
SetMenuItemInfoW(hPopup, ID_POPUPMENU_AREA, FALSE, &mii);
|
||||||
@@ -277,12 +278,17 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
}
|
}
|
||||||
if (ID_POPUPMENU_ABOUT == idMenu && !bKPressed)
|
if (ID_POPUPMENU_ABOUT == idMenu && !bKPressed)
|
||||||
{
|
{
|
||||||
|
diag_log(L"Pressed 'About' menuitem");
|
||||||
bKPressed = TRUE;
|
bKPressed = TRUE;
|
||||||
diag_log(L"Opening 'About' dialog");
|
|
||||||
DialogBoxW(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, (DLGPROC)About);
|
DialogBoxW(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, (DLGPROC)About);
|
||||||
bKPressed = FALSE;
|
bKPressed = FALSE;
|
||||||
}
|
}
|
||||||
if (ID_POPUPMENU_EXIT == idMenu) PostMessageW(hWnd, WM_CLOSE, NULL, NULL);
|
if (ID_POPUPMENU_EXIT == idMenu)
|
||||||
|
{
|
||||||
|
diag_log(L"Pressed 'Exit' menuitem");
|
||||||
|
PostMessageW(hWnd, WM_CLOSE, NULL, NULL);
|
||||||
|
}
|
||||||
|
diag_log(L"Quiting menu handler");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -297,6 +303,7 @@ LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
|
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
{
|
{
|
||||||
|
diag_log(L"Recived WM_DESTROY message");
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -385,6 +392,7 @@ BOOL CALLBACK DlgProc(HWND hDlg, UINT dlgmsg, WPARAM wParam, LPARAM lParam)
|
|||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
{
|
||||||
|
diag_log(L"Initializing 'Manual editing' dialog");
|
||||||
SetWindowTextW(hDlg, szTitle);
|
SetWindowTextW(hDlg, szTitle);
|
||||||
GetWindowTextW(hFgWnd, szWinTitle, _countof(szWinTitle));
|
GetWindowTextW(hFgWnd, szWinTitle, _countof(szWinTitle));
|
||||||
GetClassNameW(hFgWnd, szWinClass, _countof(szWinClass));
|
GetClassNameW(hFgWnd, szWinClass, _countof(szWinClass));
|
||||||
@@ -408,6 +416,7 @@ BOOL CALLBACK DlgProc(HWND hDlg, UINT dlgmsg, WPARAM wParam, LPARAM lParam)
|
|||||||
{
|
{
|
||||||
case IDC_BUTTON_SET:
|
case IDC_BUTTON_SET:
|
||||||
{
|
{
|
||||||
|
diag_log(L"Pressed 'Set' button");
|
||||||
x = GetDlgItemInt(hDlg, IDC_EDIT_X, NULL, TRUE);
|
x = GetDlgItemInt(hDlg, IDC_EDIT_X, NULL, TRUE);
|
||||||
y = GetDlgItemInt(hDlg, IDC_EDIT_Y, NULL, TRUE);
|
y = GetDlgItemInt(hDlg, IDC_EDIT_Y, NULL, TRUE);
|
||||||
w = GetDlgItemInt(hDlg, IDC_EDIT_WIDTH, NULL, FALSE);
|
w = GetDlgItemInt(hDlg, IDC_EDIT_WIDTH, NULL, FALSE);
|
||||||
@@ -415,14 +424,15 @@ BOOL CALLBACK DlgProc(HWND hDlg, UINT dlgmsg, WPARAM wParam, LPARAM lParam)
|
|||||||
SendMessageW(hFgWnd, WM_ENTERSIZEMOVE, NULL, NULL);
|
SendMessageW(hFgWnd, WM_ENTERSIZEMOVE, NULL, NULL);
|
||||||
MoveWindow(hFgWnd, x, y, w, h, TRUE);
|
MoveWindow(hFgWnd, x, y, w, h, TRUE);
|
||||||
SendMessageW(hFgWnd, WM_EXITSIZEMOVE, NULL, NULL);
|
SendMessageW(hFgWnd, WM_EXITSIZEMOVE, NULL, NULL);
|
||||||
|
diag_log(L"Window", hFgWnd, L"was moved to x = ", x, L", y = ", y);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IDCANCEL:
|
case IDCANCEL:
|
||||||
case IDC_BUTTON_CLOSE:
|
case IDC_BUTTON_CLOSE:
|
||||||
{
|
{
|
||||||
EndDialog(hDlg, LOWORD(wParam));
|
|
||||||
diag_log(L"Closing 'Manual editing' dialog");
|
diag_log(L"Closing 'Manual editing' dialog");
|
||||||
|
EndDialog(hDlg, LOWORD(wParam));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -496,6 +506,7 @@ INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
|
|||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
{
|
||||||
|
diag_log(L"Initializing 'About' dialog");
|
||||||
SetDlgItemTextW(hDlg, IDC_ABOUTHELP, szAbout);
|
SetDlgItemTextW(hDlg, IDC_ABOUTHELP, szAbout);
|
||||||
return (INT_PTR)TRUE;
|
return (INT_PTR)TRUE;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user