| 255 | } |
| 256 | |
| 257 | static LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { |
| 258 | if (g_theme >= ThemeAeroLight && $DwmDefWindowProc) { |
| 259 | LRESULT lRet = 0; |
| 260 | if ($DwmDefWindowProc(hwnd, uMsg, wParam, lParam, &lRet)) { |
| 261 | return lRet; |
| 262 | } |
| 263 | } |
| 264 | |
| 265 | switch (uMsg) { |
| 266 | case WM_THEMECHANGED: |
| 267 | case WM_DWMCOMPOSITIONCHANGED: |
| 268 | ConfigureWindow(); |
| 269 | break; |
| 270 | |
| 271 | case WM_ACTIVATE: |
| 272 | case WM_NCACTIVATE: |
| 273 | // Redraw banner on activation |
| 274 | if (g_theme == ThemeBasic) { |
| 275 | InvalidateRect(GetDlgItem(hwnd, 1046), NULL, FALSE); |
| 276 | } |
| 277 | break; |
| 278 | |
| 279 | case WM_DESTROY: |
| 280 | if (g_backgroundWindow) { |
| 281 | DestroyWindow(g_backgroundWindow); |
| 282 | g_backgroundWindow = NULL; |
| 283 | } |
| 284 | break; |
| 285 | |
| 286 | case WM_NCHITTEST: { |
| 287 | if (g_theme < ThemeBasic) { |
| 288 | break; |
| 289 | } |
| 290 | |
| 291 | // Allow drag in the header area |
| 292 | HWND bannerWindow = GetDlgItem(hwnd, 1046); |
| 293 | if (!bannerWindow) { |
| 294 | break; |
| 295 | } |
| 296 | |
| 297 | POINT hit = {GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)}; |
| 298 | ScreenToClient(hwnd, &hit); |
| 299 | |
| 300 | RECT rect = {0}; |
| 301 | GetWindowRect(bannerWindow, &rect); |
| 302 | rect.right -= rect.left; |
| 303 | rect.bottom -= rect.top; |
| 304 | rect.left = 0; |
| 305 | rect.top = 0; |
| 306 | |
| 307 | if (PtInRect(&rect, hit)) { |
| 308 | return HTCAPTION; |
| 309 | } |
| 310 | break; |
| 311 | } |
| 312 | } |
| 313 | |
| 314 | if (!g_dialogOrigWndProc) { |
nothing calls this directly
no test coverage detected