CWnd::WindowProc是cwnd类的一个虚函数,功能就是处理窗口的消息。
virtual LRESULT WindowProc( UINT message, WPARAM wParam, LPARAM lParam );
Return Value
The return value depends on the message.
Parameters
message
Specifies the Windows message to be processed.
wParam
Provides additional information used in processing the message. The parameter value depends on the message.
lParam
Provides additional information used in processing the message. The parameter value depends on the message.
Remarks
Provides a Windows procedure (WindowProc) for a CWnd object. It dispatches messages through the window’s message map.
eg:单击关闭按键后隐藏窗口
LRESULT CDIALOG140906Dlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
// TODO: Add your specialized code here and/or call the base class
switch(message)
{
case WM_SYSCOMMAND:
if(SC_CLOSE == wParam)
{
AfxGetApp()->m_pMainWnd->ShowWindow(SW_HIDE);
return 0;
}
break;
}
return CDialog::WindowProc(message, wParam, lParam);
}