Handle dark-mode-related window messages. Identical behavior to SftDarkMode_HandleDialogMessage; the result is written through an LRESULT* (the return type of a window procedure) instead of INT_PTR* (the dialog procedure return type).
C
BOOL SftDarkMode_HandleWindowMessage(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT* pResult);
hwnd
The window receiving the message.
msg, wParam, lParam
The message and its parameters as received by the window procedure.
pResult
Pointer to an LRESULT that receives the window-proc return value when the function returns TRUE. Must not be NULL.
TRUE if the message was handled by the helper. The caller must return *pResult from its window procedure.
FALSE if the message was not handled. The caller continues with its own message routing.
See SftDarkMode_HandleDialogMessage for the full list of messages handled and their behavior. HandleWindowMessage is the window-proc form of the same helper.
LRESULT CALLBACK MyWindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
LRESULT dmResult;
if (SftDarkMode_HandleWindowMessage(hwnd, msg, wParam, lParam, &dmResult))
return dmResult;
/* Application-specific handling ... */
return DefWindowProc(hwnd, msg, wParam, lParam);
}For MFC classes that override WindowProc (CFrameWnd, CMDIFrameWnd, CView subclasses), call HandleWindowMessage from the override. If you also call SftDarkMode_HandleMenuMessage from the same WindowProc, both helpers can share an LRESULT local because both take LRESULT*.
LRESULT CMainFrame::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
LRESULT dmResult;
if (SftDarkMode_HandleMenuMessage(m_hWnd, message, wParam, lParam, &dmResult))
return dmResult;
if (SftDarkMode_HandleWindowMessage(m_hWnd, message, wParam, lParam, &dmResult))
return dmResult;
return CFrameWnd::WindowProc(message, wParam, lParam);
}See Also Init | ApplyToWindow | IsActive | HandleDialogMessage | HandleMenuMessage