From b5917be252caf9d38ae9466352c4176ef25732e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Wed, 7 Sep 2022 23:33:08 +0200 Subject: Simplify Err message format. --- c/main.cpp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'c/main.cpp') diff --git a/c/main.cpp b/c/main.cpp index a988f9b..3219bd7 100644 --- a/c/main.cpp +++ b/c/main.cpp @@ -64,7 +64,7 @@ int WINAPI WinMain( icc.dwSize = sizeof(icc); icc.dwICC = ICC_WIN95_CLASSES; if (!InitCommonControlsEx(&icc)) - return EBMessageBox(Err(WINDOWS, L"Common controls could not be initialized: %s.").what, + return EBMessageBox(Err(WINDOWS, L"Common controls could not be initialized").what, L"Initialization Error", MB_ICONERROR), 1; if (CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED) != S_OK) @@ -83,7 +83,7 @@ int WINAPI WinMain( wc.lpszClassName = L"Episode Browser"; wc.hIconSm = LoadIconW(nullptr, IDI_APPLICATION); if (!RegisterClassExW(&wc)) - return EBMessageBox(Err(WINDOWS, L"Window class could not be registered: %s.").what, + return EBMessageBox(Err(WINDOWS, L"Window class could not be registered").what, L"Initialization Error", MB_ICONERROR), 1; /* InitializeMainWindow is called before the first message is @@ -98,7 +98,7 @@ int WINAPI WinMain( WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN, XMAIN, YMAIN, 0, 0, nullptr, nullptr, hInstance, nullptr))) - return EBMessageBox(Err(WINDOWS, L"Main window could not be created: %s.").what, + return EBMessageBox(Err(WINDOWS, L"Main window could not be created").what, L"Initialization Error", MB_ICONERROR), 1; if (!(g_window->hWndStatus = CreateWindowExW( @@ -108,7 +108,7 @@ int WINAPI WinMain( WS_CHILD|WS_VISIBLE|SBARS_SIZEGRIP, 0, 0, 0, 0, hWnd, reinterpret_cast(IDR_STATUS), hInstance, nullptr))) - return EBMessageBox(Err(WINDOWS, L"Status bar could not be created: %s.").what, + return EBMessageBox(Err(WINDOWS, L"Status bar could not be created").what, L"Initialization Error", MB_ICONERROR), 1; ShowWindow(hWnd, nCmdShow); @@ -153,21 +153,21 @@ static void InitializeMainWindow(const HWND hWnd) #endif if (!SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICSW), &m, 0)) - throw Err(WINDOWS, L"Non-client metrics could not be queried: %s."); + throw Err(WINDOWS, L"Non-client metrics could not be queried"); if (!(g_hfNormal = CreateFontIndirectW(&m.lfMessageFont))) - throw Err(WINDOWS, L"System message font could not be loaded: %s."); + throw Err(WINDOWS, L"System message font could not be loaded"); } else if (!(g_hfNormal = static_cast(GetStockObject(DEFAULT_GUI_FONT)))) - throw Err(WINDOWS, L"System GUI font could not be loaded: %s."); + throw Err(WINDOWS, L"System GUI font could not be loaded"); /* Load bold font. */ { LOGFONTW lf; if (!GetObjectW(g_hfNormal, sizeof(LOGFONTW), &lf)) - throw Err(WINDOWS, L"Logical system font could not be loaded: %s."); + throw Err(WINDOWS, L"Logical system font could not be loaded"); lf.lfWeight = FW_BOLD; if (!(g_hfBold = CreateFontIndirectW(&lf))) - throw Err(WINDOWS, L"Bold font could not be loaded: %s."); + throw Err(WINDOWS, L"Bold font could not be loaded"); } /* Load theme functions, if available. */ @@ -221,7 +221,7 @@ INT_PTR CALLBACK PreferencesDlgProc(const HWND hWnd, const UINT uMsg, const WPAR BIF_EDITBOX|BIF_NEWDIALOGSTYLE|BIF_NONEWFOLDERBUTTON}; if (auto pidl = SHBrowseForFolderW(&bi)) { if (!SHGetPathFromIDListW(pidl, path)) - throw Err(GENERIC, L"Invalid path selected."); + throw Err(GENERIC, L"Invalid path selected"); EBMessageBox(path, L"You Chose"); } return TRUE; @@ -287,7 +287,7 @@ LRESULT CALLBACK Window::WndProc(const HWND hWnd, const UINT uMsg, const WPARAM r->right-r->left, r->bottom-r->top, SWP_NOZORDER|SWP_NOACTIVATE)) - throw Err(WINDOWS, L"."); + throw Err(WINDOWS, L""); UpdateLayout(r->right-r->left, r->bottom-r->top); } return 0; @@ -484,9 +484,9 @@ void Window::UpdateLayout(int w, int h) RECT rc, rrStatus; if (w && h) rc = {0, 0, w, h}; else if (!GetClientRect(hWnd, &rc)) - throw Err(WINDOWS, L"Window rectangle could not be retrieved: %s."); + throw Err(WINDOWS, L"Window rectangle could not be retrieved"); if (!GetRelativeRect(hWndStatus, &rrStatus)) - throw Err(WINDOWS, L"Status bar rectangle could not be retrieved: %s."); + throw Err(WINDOWS, L"Status bar rectangle could not be retrieved"); SendMessageW(hWnd, WM_SETREDRAW, FALSE, 0); @@ -494,9 +494,9 @@ void Window::UpdateLayout(int w, int h) const long pad = EBIsThemeActive()? Dpi(6): 0; /* Add padding in modern themes. */ const long cyDlv = rrStatus.top-dlv.Height()-pad; if (!SetWindowRect(dlv.hWnd, pad, cyDlv, rc.right-pad, rrStatus.top-pad)) - throw Err(WINDOWS, L"Data list view rectangle could not be updated: %s."); + throw Err(WINDOWS, L"Data list view rectangle could not be updated"); if (!SetWindowRect(elv.hWnd, pad, pad, rc.right-pad, cyDlv-pad)) - throw Err(WINDOWS, L"Episode list view rectangle could not be updated: %s."); + throw Err(WINDOWS, L"Episode list view rectangle could not be updated"); dlv.ResizeColumns(rc.right-pad-pad); elv.ResizeColumns(rc.right-pad-pad); -- cgit v1.2.3