aboutsummaryrefslogtreecommitdiff
path: root/c/main.cpp
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-08-26 03:17:09 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-08-26 03:17:09 +0200
commiteb7709d8617bec27349eebb43e8941b3aaaf453e (patch)
tree7c8627586ed18132b0304b779a00d8acc61e7a0d /c/main.cpp
parenta9a74875dbd5340b6f3ea6d8b6f66a04b360b22a (diff)
downloadEpisodeBrowser-eb7709d8617bec27349eebb43e8941b3aaaf453e.tar.gz
Use FunctionW names explicitly instead of macros.
It's uglier, but it makes Visual Studio show better tooltips.
Diffstat (limited to 'c/main.cpp')
-rw-r--r--c/main.cpp34
1 files changed, 17 insertions, 17 deletions
diff --git a/c/main.cpp b/c/main.cpp
index 1ad62cf..7608f05 100644
--- a/c/main.cpp
+++ b/c/main.cpp
@@ -35,8 +35,8 @@ static auto _ = std::set_terminate([]() noexcept
int g_dpi = 96;
/* Cursors. */
-HCURSOR g_hcArrow = LoadCursor(nullptr, IDC_ARROW);
-HCURSOR g_hcSizeNs = LoadCursor(nullptr, IDC_SIZENS);
+HCURSOR g_hcArrow = LoadCursorW(nullptr, IDC_ARROW);
+HCURSOR g_hcSizeNs = LoadCursorW(nullptr, IDC_SIZENS);
/* Fonts. */
HFONT g_hfNormal;
@@ -98,19 +98,19 @@ int WINAPI WinMain(
wc.cbSize = sizeof(WNDCLASSEX);
wc.lpfnWndProc = WndProc;
wc.hInstance = hInstance;
- wc.hIcon = LoadIcon(nullptr, IDI_APPLICATION);
+ wc.hIcon = LoadIconW(nullptr, IDI_APPLICATION);
wc.hCursor = g_hcArrow;
wc.hbrBackground = reinterpret_cast<HBRUSH>(COLOR_WINDOW);
- wc.lpszMenuName = MAKEINTRESOURCE(IDR_MENU);
+ wc.lpszMenuName = MAKEINTRESOURCEW(IDR_MENU);
wc.lpszClassName = L"Episode Browser";
- wc.hIconSm = LoadIcon(nullptr, IDI_APPLICATION);
- Require(RegisterClassEx(&wc));
+ wc.hIconSm = LoadIconW(nullptr, IDI_APPLICATION);
+ Require(RegisterClassExW(&wc));
/* InitializeMainWindow is called before the first message is
* sent to WndProc. This is important, as it initializes
* global state on which WndProc relies. */
WithNextWindow(InitializeMainWindow);
- const HWND hWnd = Require(CreateWindowEx(
+ const HWND hWnd = Require(CreateWindowExW(
0,
L"Episode Browser",
L"Episode Browser",
@@ -118,7 +118,7 @@ int WINAPI WinMain(
XMAIN, YMAIN, 0, 0,
nullptr, nullptr, hInstance, nullptr));
- g_hWndStatus = Require(CreateWindowEx(
+ g_hWndStatus = Require(CreateWindowExW(
0,
STATUSCLASSNAME,
nullptr,
@@ -138,10 +138,10 @@ int WINAPI WinMain(
#endif
MSG msg;
- while (GetMessage(&msg, nullptr, 0, 0) > 0) {
- if (IsDialogMessage(hWnd, &msg)) continue;
+ while (GetMessageW(&msg, nullptr, 0, 0) > 0) {
+ if (IsDialogMessageW(hWnd, &msg)) continue;
TranslateMessage(&msg);
- DispatchMessage(&msg);
+ DispatchMessageW(&msg);
}
return 0;
@@ -162,27 +162,27 @@ void InitializeMainWindow(const HWND hWnd)
if (auto lib = Library::Maybe(L"User32.dll");
lib && lib->GetProcAddress<void>("SystemParametersInfoW")) {
NONCLIENTMETRICS m = {sizeof(NONCLIENTMETRICS)};
- Require(SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &m, 0));
- g_hfNormal = Require(CreateFontIndirect(&m.lfMessageFont));
+ Require(SystemParametersInfoW(SPI_GETNONCLIENTMETRICS, sizeof(NONCLIENTMETRICS), &m, 0));
+ g_hfNormal = Require(CreateFontIndirectW(&m.lfMessageFont));
} else
g_hfNormal = static_cast<HFONT>(Require(GetStockObject(DEFAULT_GUI_FONT)));
/* Load bold font. */
{
LOGFONT lf;
- Require(GetObject(g_hfNormal, sizeof(LOGFONT), &lf));
+ Require(GetObjectW(g_hfNormal, sizeof(LOGFONT), &lf));
lf.lfWeight = FW_BOLD;
- g_hfBold = Require(CreateFontIndirect(&lf));
+ g_hfBold = Require(CreateFontIndirectW(&lf));
}
/* Load theme functions, if available. */
- if (HMODULE hModule = LoadLibrary(L"uxtheme.dll")) {
+ if (HMODULE hModule = LoadLibraryW(L"uxtheme.dll")) {
IsThemeActive = (decltype(IsThemeActive))(void*)GetProcAddress(hModule, "IsThemeActive");
SetWindowTheme = (decltype(SetWindowTheme))(void*)GetProcAddress(hModule, "SetWindowTheme");
}
/* Load context menu. */
- g_hMenuPopup = Require(LoadMenu(nullptr, MAKEINTRESOURCE(IDR_POPUPMENU)));
+ g_hMenuPopup = Require(LoadMenuW(nullptr, MAKEINTRESOURCE(IDR_POPUPMENU)));
g_hMenuPopup = Require(GetSubMenu(g_hMenuPopup, 0));
/* Create child windows. */