FUNCTION: WndProcStatic(HWND, UINT, WPARAM, LPARAM) PURPOSE: Redirect messages to approriate instance or call default proc WM_COMMAND - process the application menu WM_PAINT - Paint the main window WM_DESTROY - post a quit message and return
| 51 | // |
| 52 | // |
| 53 | LRESULT CALLBACK BrowserWindow::WndProcStatic(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) |
| 54 | { |
| 55 | // Get the ptr to the BrowserWindow instance who created this hWnd. |
| 56 | // The pointer was set when the hWnd was created during InitInstance. |
| 57 | BrowserWindow* browser_window = reinterpret_cast<BrowserWindow*>(GetWindowLongPtr(hWnd, GWLP_USERDATA)); |
| 58 | if (browser_window != nullptr) |
| 59 | { |
| 60 | return browser_window->WndProc(hWnd, message, wParam, lParam); // Forward message to instance-aware WndProc |
| 61 | } |
| 62 | else |
| 63 | { |
| 64 | return DefWindowProc(hWnd, message, wParam, lParam); |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | // |
| 69 | // FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) |