CWnd类是有这个虚函数的,我孤陋寡闻,很少遇到过,看一个老外的分隔条类例子看到了以下是作者 的部分代码:
And here is the code for resizing controls on the dialog when the user moves the splitter control. Collapse | Copy Code
//// LRESULT CSPDemoDlg::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam) {
if (message == WM_NOTIFY)
{
if (wParam == IDC_SPLITTER1)
{
SPC_NMHDR* pHdr = (SPC_NMHDR*) lParam;
DoResize1(pHdr->delta);
}
}

return CDialog::DefWindowProc(message, wParam, lParam);
}
//
这个函数的作用,作者已经说了,当用户去移动分隔条的时候,就会对话框上的其他控件大小 尺寸发生变化,1:WM_NOTIFY  这个消息真奇怪, 移动分隔条 ,为什么会发出这个消息?  它是通知对话框的作用2. 如果不重写这个虚函数, 我需要在哪一个函数中 实现 这个功能:当用户去移动分隔条的时候,就会对话框上的其他控件大小 尺寸发生变化
3.  什么时候需要 我们去重写这个虚函数? 我很少遇到

解决方案 »

  1.   

    函数功能:该函数调用缺省的窗口过程来为应用程序没有处理的任何窗口消息提供缺省的处理。该函数确保每一个消息得到处理。调用DefWindowProc函数时使用窗口过程接收的相同参数。 
      

  2.   

    1. Sent by a common control to its parent window when an event has occurred or the control requires some information. 2. 你的拆分的窗口应该会收到WM_SIZE消息吧3. 
    Calls the default window procedure, which provides default processing for any window message that an application does not process. This member function ensures that every message is processed. It should be called with the same parameters as those received by the window procedure. 
      

  3.   

    移动分隔条的时候,发送WM_NOTIFY 这个消息 , 或者一个自定义的消息, 对话框收到后,就可以进行相应。。   
      

  4.   

    很明显是codeproject上的,http://blog.csdn.net/hustli/article/details/19361这篇算比较好了,不过中国的资料都是翻译来的,看着别扭...
      

  5.   

    我的一个程序里有绘制标题栏的一段,我也是初步接触,所以就不管他怎么来的,反正实现了功能//自绘标题栏
    LRESULT CCoolDialogDemoDlg::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
    {
    //画非客户区// return CDialogEx::DefWindowProc(message, wParam, lParam);
    LRESULT lrst=CDialogEx::DefWindowProc(message, wParam, lParam); if (::IsWindow(m_hWnd))
    {
    if (message==WM_MOVE||message==WM_PAINT||message==WM_NCPAINT||message==WM_NCACTIVATE ||message == WM_NOTIFY)
    {
    CDC* pWinDC = GetWindowDC();
    if (pWinDC)
    {
    //绘制标题栏
    DrawTitleBar(pWinDC);
    }
    ReleaseDC(pWinDC);
    }
    } return lrst;
    }