diff options
author | John Ankarström <john@ankarstrom.se> | 2022-08-04 18:18:37 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-08-04 18:19:37 +0200 |
commit | 94119478207034b767c1d0a4fa5d8950f7b07b02 (patch) | |
tree | ce9ffb57a4947855b09c54017f6b2abe3e8af6d3 /c/win.cpp | |
parent | 1c218db34a3bd4aba5c1c088561b91b02e691fde (diff) | |
download | EpisodeBrowser-94119478207034b767c1d0a4fa5d8950f7b07b02.tar.gz |
Use C++ casts, nullptr.
Diffstat (limited to 'c/win.cpp')
-rw-r--r-- | c/win.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -22,11 +22,11 @@ const char* Win32Error::what() const noexcept if (!m_szMsg) FormatMessageA( FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, + nullptr, code, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), (char*)&m_szMsg, - 0, NULL); + 0, nullptr); return m_szMsg; } @@ -35,11 +35,11 @@ const wchar_t* Win32Error::What() const noexcept if (!m_wszMsg) FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, + nullptr, code, MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), (wchar_t*)&m_wszMsg, - 0, NULL); + 0, nullptr); return m_wszMsg; } @@ -75,14 +75,14 @@ int EBMessageBox(const wchar_t* const wszText, const wchar_t* const wszCaption, if (!g_hWnd || nCode < 0 || nCode != HCBT_ACTIVATE) return CallNextHookEx(0, nCode, wParam, lParam); - HWND hWnd = (HWND)wParam; + HWND hWnd = reinterpret_cast<HWND>(wParam); long lStyle = GetWindowLong(hWnd, GWL_STYLE); if (!(lStyle & WS_POPUP)) return 0; RECT rcMain, rcMsg; GetWindowRect(g_hWnd, &rcMain); GetWindowRect(hWnd, &rcMsg); - SetWindowPos(hWnd, NULL, + SetWindowPos(hWnd, nullptr, rcMain.left+(rcMain.right-rcMain.left)/2-(rcMsg.right-rcMsg.left)/2, rcMain.top+(rcMain.bottom-rcMain.top)/2-(rcMsg.bottom-rcMsg.top)/2, -1, -1, @@ -91,7 +91,7 @@ int EBMessageBox(const wchar_t* const wszText, const wchar_t* const wszCaption, return 0; }; - HHOOK hHook = Require(SetWindowsHookEx(WH_CBT, proc, (HINSTANCE)NULL, GetCurrentThreadId())); + HHOOK hHook = Require(SetWindowsHookEx(WH_CBT, proc, nullptr, GetCurrentThreadId())); int r = MessageBox(g_hWnd, wszText, wszCaption, uType); Require(UnhookWindowsHookEx(hHook)); return r; @@ -102,7 +102,7 @@ int GetRelativeCursorPos(HWND hWnd, POINT* pt) RECT rc; if (!GetClientRect(hWnd, &rc)) return 0; SetLastError(ERROR_SUCCESS); - if (!MapWindowPoints(hWnd, NULL, (POINT*)&rc, 2)) return 0; + if (!MapWindowPoints(hWnd, nullptr, (POINT*)&rc, 2)) return 0; POINT ptMouse; if (!GetCursorPos(&ptMouse)) return 0; |