From 2a7f4bcd4c04d0e48e580c4b11a94174bc5b09ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Tue, 19 Jul 2022 11:56:59 +0200 Subject: Implement centered message box. --- c/main.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'c/main.cpp') diff --git a/c/main.cpp b/c/main.cpp index 08e6b96..f7b3472 100644 --- a/c/main.cpp +++ b/c/main.cpp @@ -143,10 +143,10 @@ int WINAPI WinMain(const HINSTANCE hInstance, const HINSTANCE, char* const, cons return 0; } -static LRESULT CALLBACK CBTProc(const int nCode, const WPARAM wParam, const LPARAM) +static LRESULT CALLBACK CBTProc(const int nCode, const WPARAM wParam, const LPARAM lParam) { - if (nCode != HCBT_CREATEWND) return 0; - if (g_hWnd) return 0; + if (nCode < 0 || nCode != HCBT_CREATEWND || g_hWnd) + return CallNextHookEx(0, nCode, wParam, lParam); /* This code is run once at the creation of the top-level * window -- before WndProc! This is important, as it @@ -198,7 +198,7 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam, case WM_CREATE: { UpdateTheme(); - SetWindowPos(hWnd, NULL, -1, -1, Dpi(510), Dpi(400), SWP_NOMOVE); + SetWindowPos(hWnd, NULL, -1, -1, Dpi(510), Dpi(400), SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE); SetFocus(g_pElv->hWnd); /* Set menu item checkmarks according to saved settings. */ @@ -239,7 +239,7 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam, lpr->left, lpr->top, lpr->right-lpr->left, lpr->bottom-lpr->top, - SWP_NOZORDER | SWP_NOACTIVATE); + SWP_NOZORDER|SWP_NOACTIVATE); UpdateLayout(); break; } @@ -387,7 +387,9 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam, switch (LOWORD(wParam)) { case IDM_WATCH_LOCALLY: - Pl("local_episode","open_episode_locally",lvi.lParam); + if (!Pl("local_episode","open_episode_locally",lvi.lParam)) + EBMessageBox(TEXT("Local episode could not be opened."), + TEXT("Error"), MB_ICONWARNING); break; case IDM_WATCH_ONLINE: Pl("local_episode","open_episode_online",lvi.lParam); -- cgit v1.2.3