From cf8707bf2ede99d8543d806355eee088bdc1376b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20Ankarstr=C3=B6m?= Date: Sat, 6 Aug 2022 01:21:08 +0200 Subject: Use typedefs when interacting with Win32 API. It's not like they're ever going to change the definition of WORD (knock on wood) -- but I guess it's proper to use them as if their definitions might change. --- c/main.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'c/main.cpp') diff --git a/c/main.cpp b/c/main.cpp index a672c51..a06002a 100644 --- a/c/main.cpp +++ b/c/main.cpp @@ -49,16 +49,16 @@ char g_limitScreenwriter[64]; /* Optional Windows functions. */ BOOL (*IsThemeActive)(); -BOOL (*SetWindowTheme)(HWND, LPCWSTR, LPCWSTR); +BOOL (*SetWindowTheme)(HWND, const wchar_t*, const wchar_t*); /* Initialize important global state on parent window creation. */ static LRESULT CALLBACK CBTProc(int, WPARAM, LPARAM); /* Process parent window commands. */ static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); /* Process main menu commands. */ -static void HandleMainMenu(HWND, unsigned short); +static void HandleMainMenu(HWND, WORD); /* Process context menu commands. */ -static void HandleContextMenu(HWND, unsigned short); +static void HandleContextMenu(HWND, WORD); /* Call Prolog predicate in other thread, if available. */ static void WaitFor(const char*, const char*); /* Handle messages to Help > About dialog. */ @@ -291,7 +291,7 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam, break; case WM_COMMAND: { - const unsigned short command = LOWORD(wParam); + const WORD command = LOWORD(wParam); switch (ID_GROUP(command)) { case IDG_MENU: HandleMainMenu(hWnd, command); @@ -344,8 +344,8 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam, /*IDM_RATE10*/L"Rate episode 10/10." }; - const unsigned short command = LOWORD(wParam); - const unsigned short group = ID_GROUP(command); + const WORD command = LOWORD(wParam); + const WORD group = ID_GROUP(command); const wchar_t* tip = {0}; if (group) { const wchar_t** const vTip = group==IDG_MENU? vTipMenu: vTipCtx; @@ -373,7 +373,7 @@ LRESULT CALLBACK WndProc(const HWND hWnd, const UINT uMsg, const WPARAM wParam, return 0; } -void HandleMainMenu(const HWND hWnd, unsigned short command) +void HandleMainMenu(const HWND hWnd, WORD command) { switch (command) { case IDM_FILE_EXIT: @@ -429,7 +429,7 @@ void HandleMainMenu(const HWND hWnd, unsigned short command) } } -void HandleContextMenu(const HWND, unsigned short command) +void HandleContextMenu(const HWND, WORD command) { int cNotFound = 0; @@ -556,7 +556,7 @@ INT_PTR CALLBACK AboutDlgProc(const HWND hWnd, const UINT uMsg, const WPARAM wPa void UpdateTheme() { if (!IsThemeActive) return; - const BOOL bThemeActive = IsThemeActive(); + const bool bThemeActive = IsThemeActive(); g_dlv->UpdateTheme(bThemeActive); g_elv->UpdateTheme(bThemeActive); } -- cgit v1.2.3