在OnPaint里面调用ShowWindow(SW_HIDE)就可以了。

解决方案 »

  1.   

    重载PreCreateWindow(CREATESTRUCT&   cs)函数,
    BOOL CXXDlg::PreCreateWindow(CREATESTRUCT& cs)
    {
        cs.style &= ~WS_VISIBLE;
        return CDialog::PreCreateWindow(cs);
    }
      

  2.   

    不想显示对话框,在app的instance里不要调dlg的domodal啊
      

  3.   


    +1使用 Create 来创建非模态对话框
    创建成功后,不调用ShowWindow即可
      

  4.   

    重载WM_WINDOWPOSCHANGING消息void CXXXXdlg::OnWindowPosChanging(WINDOWPOS* lpWndPos)
    {
              lpWndPos->flags &=~SWP_SHOWWINDOW;
             CDialog::OnWindowPosChanging(lpWndPos)}
      

  5.   

    OnInitialDIalog 返回FALSE 试试
      

  6.   

    返回FALSE表明可以把交点设置到其他的控件上。。否则在TAB顺序的第一个
      

  7.   

    在CXXapp的instance函数里写,例如登录窗口就是这么做的
      

  8.   

    重新调出来应该ShowWindow(SW_SHOW);就行了吧
      

  9.   

    在OnPaint() 函数中的最开始加上:
    ShowWindow(SW_HIDE);
    如下:void CMyDlg::OnPaint() 
    {
    ShowWindow(SW_HIDE);
    if (IsIconic())
    {
    CPaintDC dc(this); // device context for painting SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0); // Center icon in client rectangle
    int cxIcon = GetSystemMetrics(SM_CXICON);
    int cyIcon = GetSystemMetrics(SM_CYICON);
    CRect rect;
    GetClientRect(&rect);
    int x = (rect.Width() - cxIcon + 1) / 2;
    int y = (rect.Height() - cyIcon + 1) / 2; // Draw the icon
    dc.DrawIcon(x, y, m_hIcon);
    }
    else
    {
    CDialog::OnPaint();
    }
    }
      

  10.   

    http://blog.csdn.net/schlafenhamster/article/details/7212299
    "基于 CDialog 的应用程序一开始便被隐藏的方法"再探
      

  11.   

    添加消息WM_NCPAINT响应函数。
    在此响应函数的函数体内加 this->ShowWindow(SW_HIDE);