⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 subject_32306.htm

📁 vc
💻 HTM
字号:
<p>
序号:32306 发表者:luckyding 发表日期:2003-03-11 12:51:00
<br>主题:请看这段代码!
<br>内容:BOOL CMainFrame::PreCreateWindow(CREATESTRUCT&amp; cs)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;if( !CFrameWnd::PreCreateWindow(cs) )<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return FALSE;<BR>&nbsp;&nbsp;&nbsp;&nbsp;// TODO: Modify the Window class or styles here by modifying<BR>&nbsp;&nbsp;&nbsp;&nbsp;//&nbsp;&nbsp;the CREATESTRUCT cs<BR>&nbsp;&nbsp;&nbsp;&nbsp;cs.style &amp;= ~FWS_ADDTOTITLE; <BR>&nbsp;&nbsp;&nbsp;&nbsp;m_strTitle = "MY TESTING PROGRAM";<BR>&nbsp;&nbsp;&nbsp;&nbsp;HICON hIcon = AfxGetApp() -&gt;LoadIcon(IDI_ICON_DW);<BR>&nbsp;&nbsp;&nbsp;&nbsp;AfxGetApp() -&gt;m_pMainWnd -&gt;SendMessage(WM_SETICON,ICON_SMALL,(LPARAM)hIcon);<BR>&nbsp;&nbsp;&nbsp;&nbsp;return TRUE;<BR>}<BR>为何在AfxGetApp() -&gt;m_pMainWnd -&gt;SendMessage(WM_SETICON,ICON_SMALL,(LPARAM)hIcon);时有ASSERT错误,好像意思是说AfxGetApp() -&gt;m_pMainWnd 并不是一个窗体指针!,见下:<BR><BR>_AFXWIN_INLINE LRESULT CWnd::SendMessage(UINT message, WPARAM wParam, LPARAM lParam)<BR>&nbsp;&nbsp;&nbsp;&nbsp;{ ASSERT(::IsWindow(m_hWnd)); return ::SendMessage(m_hWnd, message, wParam, lParam); }
<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>回复者:check 回复日期:2003-03-11 12:56:09
<br>内容:在函数PreCreateWindow中主窗口还没有建立,不能向他发消息<BR>此时,m_pMainWnd=NULL
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:luckyding 回复日期:2003-03-11 13:04:44
<br>内容:噢,那我想在一开始就改变图标,该在什么地方sendmessage呢
<br>
<a href="javascript:history.go(-1)">返回上页</a><br><a href=http://www.copathway.com/cndevforum/>访问论坛</a></p></blockquote>
<hr size=1>
<blockquote><p>
回复者:check 回复日期:2003-03-12 12:59:02
<br>内容:可以在视图类的OnInitialUpdate中
<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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -