[idd] helper/CWindow: add onClose and onDestroy hooks

This commit is contained in:
Quantum
2025-09-14 16:21:10 -04:00
committed by Geoffrey McRae
parent c4f3936d98
commit d006dbb547
2 changed files with 16 additions and 0 deletions

View File

@@ -43,6 +43,10 @@ LRESULT CWindow::handleMessage(UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
case WM_CREATE: case WM_CREATE:
return onCreate(); return onCreate();
case WM_CLOSE:
return onClose();
case WM_DESTROY:
return onDestroy();
default: default:
return DefWindowProc(m_hwnd, uMsg, wParam, lParam); return DefWindowProc(m_hwnd, uMsg, wParam, lParam);
} }
@@ -53,6 +57,16 @@ LRESULT CWindow::onCreate()
return 0; return 0;
} }
LRESULT CWindow::onClose()
{
return DefWindowProc(m_hwnd, WM_CLOSE, 0, 0);
}
LRESULT CWindow::onDestroy()
{
return 0;
}
void CWindow::destroy() void CWindow::destroy()
{ {
if (m_hwnd) if (m_hwnd)

View File

@@ -8,6 +8,8 @@ class CWindow {
static LRESULT CALLBACK wndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); static LRESULT CALLBACK wndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
virtual LRESULT onCreate(); virtual LRESULT onCreate();
virtual LRESULT onClose();
virtual LRESULT onDestroy();
protected: protected:
static HINSTANCE hInstance; static HINSTANCE hInstance;