diff options
author | John Ankarström <john@ankarstrom.se> | 2022-09-02 23:51:40 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-09-02 23:51:40 +0200 |
commit | 00447478cd1d0d64752114df49fee5ee8bdcedbe (patch) | |
tree | ca1168b19ab977c1857d3a3e341a3e80b33cc6d3 /c/main.cpp | |
parent | ff9ba3f6e60fa30f52dd94e48214be5e1be1b28a (diff) | |
download | EpisodeBrowser-00447478cd1d0d64752114df49fee5ee8bdcedbe.tar.gz |
Add Act.
Diffstat (limited to 'c/main.cpp')
-rw-r--r-- | c/main.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -124,11 +124,13 @@ static void InitializeMainWindow_(const HWND hWnd) * initializes global variables that are used by WndProc. */ /* Look up DPI. */ + Act(L"looking up DPI"); if (auto lib = Library::Maybe(L"User32.dll"); auto GetDpiForWindow = lib? lib->GetProcAddress<UINT(HWND)>("GetDpiForWindow"): nullptr) g_dpi = GetDpiForWindow(hWnd); /* Load normal font. */ + Act(L"loading fonts"); if (auto lib = Library::Maybe(L"User32.dll"); lib && lib->GetProcAddress<void>("SystemParametersInfoW")) { NONCLIENTMETRICSW m = {sizeof(NONCLIENTMETRICSW)}; @@ -156,6 +158,7 @@ static void InitializeMainWindow_(const HWND hWnd) SetWindowTheme = (decltype(SetWindowTheme))(void*)GetProcAddress(hModule, "SetWindowTheme"); } + Act(L"setting up main window"); g_window = new Window(hWnd); } @@ -164,17 +167,18 @@ void InitializeMainWindow(const HWND hWnd) noexcept try { InitializeMainWindow_(hWnd); } catch (...) { - ShowException(L"Initialization failed due to an error: %s"); + ShowException(L"Initialization failed due to an error while %s: %s"); exit(1); } } LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam, const LPARAM lParam) { + Act(nullptr); try { return g_window->WndProc(hWnd, uMsg, wParam, lParam); } catch (...) { - ShowException(L"The action was cancelled due to an error: %s"); + ShowException(L"The action was cancelled due to an error while %s: %s"); } return DefWindowProc(hWnd, uMsg, wParam, lParam); } @@ -200,6 +204,7 @@ LRESULT CALLBACK Window::WndProc(const HWND hWnd, const UINT uMsg, const WPARAM { switch (uMsg) { case WM_CREATE: + Act(L"creating main window"); UpdateTheme(); SetWindowPos(hWnd, nullptr, -1, -1, Dpi(510), Dpi(412), SWP_NOZORDER|SWP_NOMOVE|SWP_NOACTIVATE); SetFocus(elv.hWnd); @@ -426,7 +431,7 @@ void Window::HandleMainMenu(const HWND hWnd, const WORD command) } } -void Window::Status(const wchar_t* msg, unsigned short i) +void Window::Status(const wchar_t* msg, unsigned short i) noexcept { SendMessage(hWndStatus, SB_SETTEXT, MAKEWPARAM(i, 0), reinterpret_cast<LPARAM>(msg)); } |