我用单文档截面, 加了一个登录窗口,可总和主界面一起出现,我刚接触VC,请问如何解决,多谢指点.
  登录窗口instance中 CLoginDlg dlg;

int nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
// TODO: Place code here to handle when the dialog is
//  dismissed with OK

m_pMainWnd->ShowWindow(SW_SHOW);
m_pMainWnd->UpdateWindow(); return TRUE;
}
else if (nResponse == IDCANCEL)
{
// TODO: Place code here to handle when the dialog is
//  dismissed with Cancel
return false;
}

解决方案 »

  1.   

    CLoginDlg dlg;
    int nResponse = dlg.DoModal();
    if (nResponse == IDOK)
    {
    }把这行代码放到你的APP类的InitInstance里面
      

  2.   

    不好意思,搞错了,是放在VIEW类的OnInitialUpdate里
      

  3.   

    CLoginDlg dlg;
    int nResponse = dlg.DoModal();
    if (nResponse == IDOK)
    {}
    else  //密码错误的话,退出系统
    {
       AfxGetMainWnd()->sendmessage(WM_CLOSE,0m,0);  //这样就可以了
    }
      

  4.   

    I tried. It can work when I put the code into APP's InitInstance.
      

  5.   

    多谢诸位朋友,尤其是xjkiller(落魄) ,问题已解决.
      .
      

  6.   

    多谢诸位朋友,尤其是xjkiller(落魄) ,问题已解决.