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

📄 subject_65671.htm

📁 vc
💻 HTM
字号:
<p>
序号:65671 发表者:jackey2 发表日期:2003-12-18 19:38:13
<br>主题:请帮忙看看我的程序:OnTimer函数怎么不执行?
<br>内容:我根据MSDN的例子,在类CTransparentImage的OnMouseMove中加入了代码:<BR>SetTimer(1,1000,0);<BR>并在OnTimer函数中加入代码:<BR>MessageBox(&#34;你好!&#34;);<BR>可是当我在CTransparentImage的对象按钮上移动鼠标是,程序并不执行:<BR>MessageBox(&#34;你好!&#34;);<BR>什么反应也没有,这是怎么回事呀?<BR>按我的理解,SetTimer(1,1000,0)触发了OnTimer函数,使它每1000毫秒执行一次,直到有KillTimer结束它,不知对不对?<BR><BR>程序奉上,请帮忙看看,非常感谢!
<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>回复者:hurtmanzc 回复日期:2003-12-18 20:04:34
<br>内容:错误1:你的消息映射区没有ON_WM_MOUSEMOVE(),你为什么不用类向导处理WM_MOUSEMOVE?<BR><BR>BEGIN_MESSAGE_MAP(CTransparentImage, CStatic)<BR>&nbsp;&nbsp;&nbsp;&nbsp;//{{AFX_MSG_MAP(CTransparentImage)<BR>&nbsp;&nbsp;&nbsp;&nbsp;ON_WM_PAINT()<BR>&nbsp;&nbsp;&nbsp;&nbsp;ON_WM_LBUTTONDOWN()<BR>&nbsp;&nbsp;&nbsp;&nbsp;ON_WM_LBUTTONUP()<BR>&nbsp;&nbsp;&nbsp;&nbsp;ON_CONTROL_REFLECT(BN_CLICKED, OnClicked)<BR>&nbsp;&nbsp;&nbsp;&nbsp;ON_WM_TIMER()<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ON_WM_MOUSEMOVE()//加入这一行<BR>&nbsp;&nbsp;&nbsp;&nbsp;//}}AFX_MSG_MAP<BR>END_MESSAGE_MAP()<BR><BR><BR>错误2:不要调用CTransparentImage::OnMouseMove(nFlags, point);<BR><BR>void CTransparentImage::OnMouseMove(UINT nFlags, CPoint point)<BR>{<BR>&nbsp;&nbsp;&nbsp;&nbsp;SetTimer(1,1000,0);<BR>&nbsp;&nbsp;&nbsp;&nbsp;//CTransparentImage::OnMouseMove(nFlags, point);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CStatic::OnMouseMove(nFlags, point);<BR>}<BR>2003-12-18 20:08:24

⌨️ 快捷键说明

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