谢谢!

解决方案 »

  1.   

    CDialogBox is CWnd derived class. And CWnd in order 
    have defined PreCreateWindow virtual function. So you just have to override
    CDialog_Derived_Window::PreCreateWindow() (the same way like for
    MainFrame::PreCreateWindow())
      

  2.   

    consult this FAQ
    Q:
    > I want to register  my own class name  for my dialog window. I add my
    > register code in the preCreateWindow routine, however, it cannot work. I
    > debug my code and  found that it doesn't execute the preCreateWindow routine
    > when my window is created.  Does someone tell me why it doesn't go through
    > this routine?  Any help is really appreciated.

    A:
    In a dialog application MFC does not create (or precreate) your window,
    it uses the Win32 dialog functions instead.  Quicker and simpler, but
    they don't take a user-defined window class name.  That means the
    dialog's class name is "Dialog".  So what you want is just incompatible
    with the standard MFC dialog application.  You could consider a doc/view
    app with a formview, or just roll your own window.
      

  3.   

    采用doc/view 结构,重载虚函数 PreCreateWindow;而对话框应重载CDialog_Derived_Window::PreCreateWindow()函数, 就这意思吧,  不过我觉得初始化的放在 OnInitDialog()中就行了啊
      

  4.   

    那我具体怎么改呢?CDialog_Derived_Window是什么类?就是我的主对话框吗?我就是那么用的。
    我要修改cs结构,所以要用到PreCreateWindow函数,有什么别的方法可以达到这个目的吗?