diff options
Diffstat (limited to 'c/common.h')
-rw-r--r-- | c/common.h | 36 |
1 files changed, 18 insertions, 18 deletions
@@ -14,30 +14,30 @@ struct wstring_owner { wstring_owner(); - wstring_owner(wchar_t* wsz); - wstring_owner& operator=(wchar_t* wsz); - wstring_owner(wstring_owner& wso) = delete; - wstring_owner& operator=(wstring_owner& wso) = delete; - wstring_owner(wstring_owner&& wso) noexcept; - wstring_owner& operator=(wstring_owner&& wso) noexcept; + wstring_owner(wchar_t* s); + wstring_owner& operator=(wchar_t* s); + wstring_owner(wstring_owner& other) = delete; + wstring_owner& operator=(wstring_owner& other) = delete; + wstring_owner(wstring_owner&& other) noexcept; + wstring_owner& operator=(wstring_owner&& other) noexcept; wchar_t *release(); operator bool() const; ~wstring_owner(); wchar_t* p = nullptr; }; -wstring_owner WsoFromSz(const char* sz, int iCp = CP_UTF8); +wstring_owner WsoFromSz(const char* buf, int cp = CP_UTF8); int EBMessageBox(const wchar_t* wszText, const wchar_t* wszCaption, unsigned uType); -wstring_owner WsoCopy(const wchar_t* wsz); +wstring_owner WsoCopy(const wchar_t* s); struct Win32Error : public std::exception { Win32Error(); - Win32Error(DWORD dwErr); + Win32Error(DWORD code); ~Win32Error(); const char* what() const noexcept; const wchar_t* WhatW() const noexcept; - DWORD dwErr; + DWORD code; private: char* m_szMsg = NULL; wchar_t* m_wszMsg = NULL; @@ -45,7 +45,7 @@ private: struct Library { - Library(const wchar_t* wszLibrary); + Library(const wchar_t* lib); ~Library(); template <class T> T* GetProcAddress(const char* szProc); private: @@ -59,9 +59,9 @@ T* Library::GetProcAddress(const char* const szProc) } template<size_t N, typename... T> -inline int wszf(wchar_t (&wsz)[N], const wchar_t* const wszFmt, T... xs) +inline int wszf(wchar_t (&buf)[N], const wchar_t* const fmt, T... xs) { - return _snwprintf_s(wsz, N, _TRUNCATE, wszFmt, xs...); + return _snwprintf_s(buf, N, _TRUNCATE, fmt, xs...); } /* Create and return an object of type C. If construction fails, @@ -103,8 +103,8 @@ inline T prefer(const T x) /* Return integer scaled for current DPI. */ inline int Dpi(const int i) { - extern int g_iDPI; - return MulDiv(i, g_iDPI, 96); + extern int g_dpi; + return MulDiv(i, g_dpi, 96); } inline int Cmp(const int a, const int b) @@ -115,10 +115,10 @@ inline int Cmp(const int a, const int b) } /* Get window rectangle relative to parent. */ -inline BOOL GetRelativeRect(const HWND hWnd, RECT* const pRr) +inline BOOL GetRelativeRect(const HWND hWnd, RECT* const rr) { - if (!GetClientRect(hWnd, pRr)) return 0; - return MapWindowPoints(hWnd, GetParent(hWnd), (POINT*)pRr, 2); + if (!GetClientRect(hWnd, rr)) return 0; + return MapWindowPoints(hWnd, GetParent(hWnd), (POINT*)rr, 2); } inline BOOL SetWindowRect(const HWND hWnd, |