From eb7709d8617bec27349eebb43e8941b3aaaf453e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= <john@ankarstrom.se> Date: Fri, 26 Aug 2022 03:17:09 +0200 Subject: Use FunctionW names explicitly instead of macros. It's uglier, but it makes Visual Studio show better tooltips. --- c/win.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'c/win.cpp') diff --git a/c/win.cpp b/c/win.cpp index 43744dd..e1349bc 100644 --- a/c/win.cpp +++ b/c/win.cpp @@ -27,7 +27,7 @@ void WithNextWindow(void (*proc)(HWND)) * accept a capturing lambda as the hook procedure. */ static thread_local auto procNext = proc; - static thread_local HHOOK hHook = Require(SetWindowsHookEx(WH_CBT, [](const int nCode, + static thread_local HHOOK hHook = Require(SetWindowsHookExW(WH_CBT, [](const int nCode, const WPARAM wParam, const LPARAM lParam) -> LRESULT CALLBACK { if (nCode == HCBT_CREATEWND) { @@ -56,7 +56,7 @@ static void CenterNextWindow(HWND hWnd) hWndParent = hWnd; hWndNext = nullptr; - hHook = Require(SetWindowsHookEx(WH_CBT, [](const int nCode, + hHook = Require(SetWindowsHookExW(WH_CBT, [](const int nCode, const WPARAM wParam, const LPARAM lParam) noexcept -> LRESULT CALLBACK { if (!hWndNext && nCode == HCBT_CREATEWND) { @@ -66,7 +66,7 @@ static void CenterNextWindow(HWND hWnd) && reinterpret_cast<HWND>(wParam) == hWndNext) { Require(UnhookWindowsHookEx(hHook)); - long lStyle = GetWindowLong(hWndNext, GWL_STYLE); + long lStyle = GetWindowLongW(hWndNext, GWL_STYLE); if (!(lStyle & WS_POPUP)) return 0; RECT rcMain, rcMsg; @@ -156,7 +156,7 @@ const char* Win32Error::what() const noexcept const wchar_t* Win32Error::What() const noexcept { if (!m_wszMsg) - FormatMessage( + FormatMessageW( FORMAT_MESSAGE_ALLOCATE_BUFFER |FORMAT_MESSAGE_FROM_SYSTEM |FORMAT_MESSAGE_FROM_HMODULE @@ -184,7 +184,7 @@ InternetError::InternetError(DWORD codeSystem) cch = len+1; m_wszMsg = new wchar_t[cch]; - if (!InternetGetLastResponseInfo(&code, m_wszMsg, &len)) + if (!InternetGetLastResponseInfoW(&code, m_wszMsg, &len)) throw Win32Error(); } @@ -206,7 +206,7 @@ const wchar_t* InternetError::What() const noexcept std::optional<Library> Library::Maybe(const wchar_t* const lib) noexcept { - HMODULE hModule = LoadLibrary(lib); + HMODULE hModule = LoadLibraryW(lib); if (!hModule) return {}; return Library(hModule); } @@ -216,7 +216,7 @@ Library::Library(const HMODULE hModule) noexcept Library::Library(const wchar_t* const lib) { - m_hModule = LoadLibrary(lib); + m_hModule = LoadLibraryW(lib); if (!m_hModule) throw Win32Error(); } -- cgit v1.2.3