隐藏MFC对话视窗 [英] Hide an MFC dialog window
本文介绍了隐藏MFC对话视窗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我已经编写了一个基于MFC对话框的应用程序,该应用程序由另一个应用程序启动.目前,我还没有添加任何代码.这只是我得到的默认文件.另一个应用程序可以成功启动我的应用程序.
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. The other application can successfully launch my application.
我正在尝试在其他应用程序启动时隐藏我的应用程序的窗口.
I am trying to hide the window of my application when the other application launches it.
BOOL CMyApp::InitInstance()
{
CMyAppDlg dlg;
m_pMainWnd = &dlg;
INT_PTR nResponse = dlg.DoModal();
if (nResponse == IDOK)
{
}
else if (nResponse == IDCANCEL)
{
}
return FALSE;
}
我尝试使用:
dlg.ShowWindow(SW_HIDE)
但是它仍然不会隐藏窗口.
but it still does not hide the window.
我如何完成此任务?
推荐答案
上述问题的解决方案. InitInstance代码应如下所示:
Solution to the above issue. The InitInstance code should be as follows:
BOOL CMyApp::InitInstance()
{
CWinApp::InitInstance();
AfxEnableControlContainer();
CMyAppDlg dlg;
dlg.Create(IDD_MyAppUI_DIALOG,NULL);
dlg.ShowWindow(SW_HIDE);
dlg.UpdateWindow();
m_pMainWnd = &dlg;
return TRUE;
}
这篇关于隐藏MFC对话视窗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文