Hide an MFC dialog window

后端 未结 6 2070
轮回少年
轮回少年 2020-12-19 17:46

I have written an MFC dialog based application which is launched by some another application. For now, I have not added any code. It is just the default files that I got. Th

6条回答
  •  -上瘾入骨i
    2020-12-19 18:15

    You must hide the dialog from the inside.

    1. Overload OnInitDialog
    2. Call CDialogEx::OnInitDialog()
    3. Hide your window and return

    Here is the code

    BOOL CMyAppDlg::OnInitDialog()
    {
        BOOL result = CDialogEx::OnInitDialog();
    
        this->ShowWindow(SW_HIDE);
    
        return result;  // return TRUE  unless you set the focus to a control
    }
    

    There is another method with a sentinel value, YMMV.

提交回复
热议问题