aboutsummaryrefslogtreecommitdiff
path: root/c/main.cpp
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-07-19 11:56:59 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-07-19 11:56:59 +0200
commit2a7f4bcd4c04d0e48e580c4b11a94174bc5b09ae (patch)
treea0286659c4dbf55c068ed6f3d172a56d53c9c27c /c/main.cpp
parent53abfac6acd04dff80ec6c8cfb0dd53f2f74dadb (diff)
downloadEpisodeBrowser-2a7f4bcd4c04d0e48e580c4b11a94174bc5b09ae.tar.gz
Implement centered message box.
Diffstat (limited to 'c/main.cpp')
-rw-r--r--c/main.cpp14
1 files changed, 8 insertions, 6 deletions
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);