我在一个dialog类下建立OnInitDialog()函数
然后重载CDialog::OnInitDialog();
可是当我的OnInitDialog()返回FALSE时,这个窗口也会出现,程序没有终止~问什么??

解决方案 »

  1.   

    virtual BOOL OnInitDialog( ); 
    Return Value
    Specifies whether the application has set the input focus to one of the controls in the dialog box. If OnInitDialog returns nonzero, Windows sets the input focus to the first control in the dialog box. The application returns zero only if it has explicitly set the input focus to a control in the dialog box.
      

  2.   

    不大明白你的意思,假如你要关掉对话框,可以调用
    CDialog::OnOK();
      

  3.   

    是一个对话框程序;
    BOOL CMyDialog::OnInitDialog( ); 
    {
       CDialog::OnInitDialog();
       ........   if(flag)
       {
         使对话框出现;
       } 
       else
      {
         不让对话框出现直接退出此程序;
       }
    }
      

  4.   

    应该如何实现,请说明下原理机制~它是如何阻止CreateWindow的~谢谢!
      

  5.   

    应该在OnCreate里写这段代码吧
      

  6.   

    BOOL CMyDialog::OnInitDialog( ); 
    {
       CDialog::OnInitDialog();
       ........   if(flag)
       {
         使对话框出现;
       } 
       else
      {
         OnOK();
       }
    }
      

  7.   

    在App类的初始化函数中处理
    直接return
      

  8.   

    在APP下可行~但是如果我非要在这个函数下实现该怎么办?难道做不到的??既然是初始化窗口怎么连这个都做不到啊~
      

  9.   

    不可能的。
    因为,onInitDialog时,CreateWindowEx已经调用了,窗口已经存在了。所以.........
      

  10.   

    先Create再初始化的,见深入浅出MFC
    初始化的时候最多能让窗口不显示