subject_21462.htm

来自「一些关于vc的问答」· HTM 代码 · 共 24 行

HTM
24
字号
<p>
序号:21462 发表者:俞建军 发表日期:2002-11-17 20:33:18
<br>主题:基于对话框的应用程序中的m_pMainWnd是什么含义?
<br>内容:一个最简单的基于对话框的应用程序,在应用程序的InitInstance函数中有以下语句: <BR><BR>BOOL CVisionApp::InitInstance() <BR>{ <BR>AfxEnableControlContainer(); <BR><BR>// Standard initialization <BR>// If you are not using these features and wish to reduce the size <BR>//&nbsp;&nbsp;of your final executable, you should remove from the following <BR>//&nbsp;&nbsp;the specific initialization routines you do not need. <BR><BR>#ifdef _AFXDLL <BR>Enable3dControls(); // Call this when using MFC in a shared DLL <BR>#else <BR>Enable3dControlsStatic(); // Call this when linking to MFC statically <BR>#endif <BR><BR>CVisionDlg dlg; <BR>m_pMainWnd = &amp;dlg;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//*********这句 <BR>int nResponse = dlg.DoModal(); <BR>if (nResponse == IDOK) <BR>{ <BR>// TODO: Place code here to handle when the dialog is <BR>//&nbsp;&nbsp;dismissed with OK <BR>} <BR>else if (nResponse == IDCANCEL) <BR>{ <BR>// TODO: Place code here to handle when the dialog is <BR>//&nbsp;&nbsp;dismissed with Cancel <BR>} <BR><BR>// Since the dialog has been closed, return FALSE so that we exit the <BR>//&nbsp;&nbsp;application, rather than start the application's message pump. <BR>return FALSE; <BR>} <BR><BR>其中的m_pMainWnd在应用程序的所有文件中找不到第二个存在的地方,它的定义是什么?有什么特殊用途? 
<br><a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p>
<hr size=1>
<blockquote><p>
<font color=red>答案被接受</font><br>回复者:凯凯 回复日期:2002-11-17 20:38:36
<br>内容:基于对话框的程序,主窗口就是对话框窗口。
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:俞建军 回复日期:2002-11-17 20:40:37
<br>内容:那这句话究竟有什么用?怎么定义的?我发现删除了也没什么关系
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:凯凯 回复日期:2002-11-17 20:53:58
<br>内容:每个MFC工程都有一个APP类的对象,m_pMainWnd是这个类的一个成员,指和主窗口,就这么简单。你删掉它,暂时没关系,如果APP类的某个函数要用到这个成员时,就会有问题了。
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?