怎么隐藏主窗口,在登录验证身份成功后,关闭登录窗口,再显示主窗口,不要主窗口出现一闪而过的痕迹。
void CMainFrame::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos) 
{
   //FrameWnd::OnWindowPosChanging(lpwndpos);    ModifyStyleEx(WS_EX_APPWINDOW,WS_EX_TOOLWINDOW);
WINDOWPLACEMENT wp;
wp.length=sizeof(WINDOWPLACEMENT);
wp.flags=WPF_RESTORETOMAXIMIZED;
wp.showCmd=SW_HIDE;
SetWindowPlacement(&wp);   }
这样能隐藏,可是再显示时候,窗口的最大化,最小化按钮不见了,只有关闭按钮"X".
有什么好办法吗?

解决方案 »

  1.   

    XXapp.cpp中
    BOOL CXXApp::InitInstance()
    {
    // Initialize OLE libraries
    if (!AfxOleInit())
    {
    AfxMessageBox(IDP_OLE_INIT_FAILED);
    return FALSE;
    }
             AfxEnableControlContainer();
    CFDlg dlg;                      //登录对话框
    if(dlg.DoModal()==IDOK)
    {
    #ifdef _AFXDLL
    Enable3dControls(); // Call this when using MFC in a shared DLL
    #else
    Enable3dControlsStatic(); // Call this when linking to MFC statically
    #endif
    SetRegistryKey(_T("Local AppWizard-Generated Applications")); LoadStdProfileSettings();  // Load standard INI file options (including MRU)
    CSingleDocTemplate* pDocTemplate;
    pDocTemplate = new CSingleDocTemplate(
    IDR_MAINFRAME,
    RUNTIME_CLASS(CTestrichviewDoc),
    RUNTIME_CLASS(CMainFrame),       // main SDI frame window
    RUNTIME_CLASS(CTestrichviewView));
    pDocTemplate->SetContainerInfo(IDR_CNTR_INPLACE);
    AddDocTemplate(pDocTemplate); // Parse command line for standard shell commands, DDE, file open
    CCommandLineInfo cmdInfo;
    ParseCommandLine(cmdInfo); // Dispatch commands specified on the command line
    if (!ProcessShellCommand(cmdInfo))
    return FALSE;
       m_pMainWnd->ShowWindow(SW_SHOW); //控制显示
       m_pMainWnd->UpdateWindow();
    } return TRUE;
    }
      

  2.   

    处理OnWindowPosChanging消息,将WS_SHOW去掉就可以隐藏程序了
      

  3.   

    tleon(澎蜞) 写出代码来看看,好吗?
      

  4.   

    http://www.codetools.com/system/xyntservice.asp
      

  5.   

    在初始化函数中加:
    if(code.DoModal()==IDOK)
    {
            
    }
    else
    {
    this->ShowWindow(SW_HIDE);
    this->DestroyWindow();
    return FALSE;
    }