📄 深入剖析mfc中windows消息处理、运行机制.htm
字号:
<TR>
<TD vAlign=center align=left
background=深入剖析MFC中Windows消息处理、运行机制.files/bg_dot.gif
colSpan=10 height=1></TD></TR>
<TR onmouseover="this.bgColor='#C5C5C5'"
onmouseout="this.bgColor='#EFEFEF'">
<TD vAlign=center align=left height=20>
<LI type=square> <A
title="工具条,工具提示,状态条,菜单,按钮,组合框,对话框,单文档界面,多文档界面,视图分割,窗口管理 等界面类编程"
href="http://www.vczx.com/article/list.php?type=2"
target=_blank><FONT face=Verdana
color=#000000>界面编程</FONT></A></LI></TD></TR>
<TR>
<TD vAlign=center align=left
background=深入剖析MFC中Windows消息处理、运行机制.files/bg_dot.gif
colSpan=10 height=1></TD></TR>
<TR onmouseover="this.bgColor='#C5C5C5'"
onmouseout="this.bgColor='#EFEFEF'">
<TD vAlign=center align=left height=20>
<LI type=square> <A
title=多线程多任务,消息系统,磁盘,文件操作,钩子,驱动程序开发,Shell编程,注册表等
href="http://www.vczx.com/article/list.php?type=3"
target=_blank><FONT face=Verdana
color=#000000>系统编程</FONT></A></LI></TD></TR>
<TR>
<TD vAlign=center align=left
background=深入剖析MFC中Windows消息处理、运行机制.files/bg_dot.gif
colSpan=10 height=1></TD></TR>
<TR onmouseover="this.bgColor='#C5C5C5'"
onmouseout="this.bgColor='#EFEFEF'">
<TD vAlign=center align=left height=20>
<LI type=square> <A title=网络与通信编程
href="http://www.vczx.com/article/list.php?type=4"
target=_blank><FONT face=Verdana
color=#000000>网络编程</FONT></A></LI></TD></TR>
<TR>
<TD vAlign=center align=left
background=深入剖析MFC中Windows消息处理、运行机制.files/bg_dot.gif
colSpan=10 height=1></TD></TR>
<TR onmouseover="this.bgColor='#C5C5C5'"
onmouseout="this.bgColor='#EFEFEF'">
<TD vAlign=center align=left height=20>
<LI type=square> <A title=模板组件类编程
href="http://www.vczx.com/article/list.php?type=5"
target=_blank><FONT face=Verdana
color=#000000>模板组件类</FONT></A></LI></TD></TR>
<TR>
<TD vAlign=center align=left
background=深入剖析MFC中Windows消息处理、运行机制.files/bg_dot.gif
colSpan=10 height=1></TD></TR>
<TR onmouseover="this.bgColor='#C5C5C5'"
onmouseout="this.bgColor='#EFEFEF'">
<TD vAlign=center align=left height=20>
<LI type=square> <A title=文件打印编程
href="http://www.vczx.com/article/list.php?type=6"
target=_blank><FONT face=Verdana
color=#000000>打印编程</FONT></A></LI></TD></TR>
<TR>
<TD vAlign=center align=left
background=深入剖析MFC中Windows消息处理、运行机制.files/bg_dot.gif
colSpan=10 height=1></TD></TR>
<TR onmouseover="this.bgColor='#C5C5C5'"
onmouseout="this.bgColor='#EFEFEF'">
<TD vAlign=center align=left height=20>
<LI type=square> <A title=数据库编程
href="http://www.vczx.com/article/list.php?type=7"
target=_blank><FONT face=Verdana
color=#000000>数据库编程</FONT></A></LI></TD></TR>
<TR>
<TD vAlign=center align=left
background=深入剖析MFC中Windows消息处理、运行机制.files/bg_dot.gif
colSpan=10 height=1></TD></TR>
<TR onmouseover="this.bgColor='#C5C5C5'"
onmouseout="this.bgColor='#EFEFEF'">
<TD vAlign=center align=left height=20>
<LI type=square> <A title=图形图像多媒体类编程
href="http://www.vczx.com/article/list.php?type=8"
target=_blank><FONT face=Verdana
color=#000000>多媒体编程</FONT></A></LI></TD></TR>
<TR>
<TD vAlign=center align=left
background=深入剖析MFC中Windows消息处理、运行机制.files/bg_dot.gif
colSpan=10 height=1></TD></TR>
<TR onmouseover="this.bgColor='#C5C5C5'"
onmouseout="this.bgColor='#EFEFEF'">
<TD vAlign=center align=left height=20>
<LI type=square> <A title=游戏类编程
href="http://www.vczx.com/article/list.php?type=12"
target=_blank><FONT face=Verdana
color=#000000>游戏编程</FONT></A></LI></TD></TR>
<TR>
<TD vAlign=center align=left
background=深入剖析MFC中Windows消息处理、运行机制.files/bg_dot.gif
colSpan=10 height=1></TD></TR>
<TR onmouseover="this.bgColor='#C5C5C5'"
onmouseout="this.bgColor='#EFEFEF'">
<TD vAlign=center align=left height=20>
<LI type=square> <A title=dll编程
href="http://www.vczx.com/article/list.php?type=13"
target=_blank><FONT face=Verdana
color=#000000>dll 编程</FONT></A></LI></TD></TR>
<TR>
<TD vAlign=center align=left
background=深入剖析MFC中Windows消息处理、运行机制.files/bg_dot.gif
colSpan=10 height=1></TD></TR>
<TR onmouseover="this.bgColor='#C5C5C5'"
onmouseout="this.bgColor='#EFEFEF'">
<TD vAlign=center align=left height=20>
<LI type=square> <A title=各种控件
href="http://www.vczx.com/article/list.php?type=11"
target=_blank><FONT face=Verdana
color=#000000>控件类编程</FONT></A></LI></TD></TR>
<TR>
<TD vAlign=center align=left
background=深入剖析MFC中Windows消息处理、运行机制.files/bg_dot.gif
colSpan=10 height=1></TD></TR>
<TR onmouseover="this.bgColor='#C5C5C5'"
onmouseout="this.bgColor='#EFEFEF'">
<TD vAlign=center align=left height=20>
<LI type=square> <A title=各种算法
href="http://www.vczx.com/article/list.php?type=14"
target=_blank><FONT face=Verdana
color=#000000>经典算法</FONT></A></LI></TD></TR>
<TR>
<TD vAlign=center align=left
background=深入剖析MFC中Windows消息处理、运行机制.files/bg_dot.gif
colSpan=10 height=1></TD></TR>
<TR onmouseover="this.bgColor='#C5C5C5'"
onmouseout="this.bgColor='#EFEFEF'">
<TD vAlign=center align=left height=20>
<LI type=square> <A title=C/C++编程
href="http://www.vczx.com/article/list.php?type=9"
target=_blank><FONT face=Verdana
color=#000000>C/C++编程</FONT></A></LI></TD></TR>
<TR>
<TD vAlign=center align=left
background=深入剖析MFC中Windows消息处理、运行机制.files/bg_dot.gif
colSpan=10 height=1></TD></TR>
<TR onmouseover="this.bgColor='#C5C5C5'"
onmouseout="this.bgColor='#EFEFEF'">
<TD vAlign=center align=left height=20>
<LI type=square> <A title=XML/.NET技术
href="http://www.vczx.com/article/list.php?type=10"
target=_blank><FONT face=Verdana
color=#000000>XML/.NET</FONT></A></LI></TD></TR>
<TR>
<TD vAlign=center align=left
background=深入剖析MFC中Windows消息处理、运行机制.files/bg_dot.gif
colSpan=10 height=1></TD></TR>
<TR onmouseover="this.bgColor='#C5C5C5'"
onmouseout="this.bgColor='#EFEFEF'">
<TD vAlign=center align=left height=20>
<LI type=square> <A title=其它编程
href="http://www.vczx.com/article/list.php?type=15"
target=_blank><FONT face=Verdana
color=#000000>其它编程</FONT></A></LI></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE>
<TABLE id=AutoNumber20 style="BORDER-COLLAPSE: collapse"
borderColor=#111111 cellSpacing=0 cellPadding=0
width="99%" align=center border=0>
<TBODY>
<TR>
<TD width="99%"></TD></TR></TBODY></TABLE>
<TABLE id=AutoNumber20 style="BORDER-COLLAPSE: collapse"
borderColor=#111111 cellSpacing=0 cellPadding=0
width="99%" align=center border=0>
<TBODY>
<TR>
<TD
background=深入剖析MFC中Windows消息处理、运行机制.files/bg_dot.gif
colSpan=10
height=1></TD></TR></TBODY></TABLE><BR></TD></TR></TBODY></TABLE></TD></TR></TBODY></TABLE></TD>
<TD vAlign=top align=left width="87%" height=312>
<TABLE cellSpacing=0 cellPadding=0 width="99%" align=center
border=0>
<TBODY>
<TR>
<TD align=left>当前位置: <A class=b href="http://www.vczx.com/"
target=_self>首页</A> >> <A class=b
href="http://www.vczx.com/article/list.php"
target=_blank>技术文章</A> >> 系统编程 </TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="100%" align=center
border=0>
<TBODY>
<TR>
<TD align=left width="2%" bgColor=#efefef> </TD>
<TD align=left width="83%"
bgColor=#efefef><BR>文章标题:<B>深入剖析MFC中Windows消息处理、运行机制</B><BR>原
作 者:mahongxi<BR>原 出 处:不详<BR>发 布
者:loose_went<BR>发布类型:转载<BR>发布日期:2004-08-09<BR>今日浏览:4<BR>总 浏
览:10319<BR></TD>
<TD vAlign=bottom align=left width="15%"
bgColor=#efefef></TD></TR></TBODY></TABLE>
<TABLE cellSpacing=0 cellPadding=0 width="96%" align=center
border=0>
<TBODY>
<TR>
<TD vAlign=top align=left bgColor=#ffffff><BR>序:
<BR>本人对Windows系统、MFC谈不上有深入的了解,但对MFC本身包装API的机制很有兴趣,特别是读了候老师的《深入浅出MFC》后,感觉到VISUAL
C++的Application
FrameWork十分精制[不敢用“完美”一词]。在以前,我对SDI结构处理消息有一定的认识,但对于模式对话框的消息机制不了解,读了《深入》一书也没能得到解决,近日,通过在CSDN上网友的帮助,和查阅MSDN,自认为已经了解。一时兴起,写下这些文字,没有其它目的,只是希望让后来者少走弯路,也希望和我一样喜欢“钻牛角尖”的人共同讨论、学习。如果你是牛人,那么你现在要慎重考虑有没有充足的时间读这些幼稚文字[何出此言?请大家看一下:http://www.csdn.net/expert/topic/13/13451.xml的相关评论]。本文中有些“理论”是我自己胡乱猜测,还请大家指正.[文中内容有些不可避免的会和《深入》一书某些内容重复]。
<BR><BR>正文:
<BR><BR>Windows程序和DOS程序的主要不同点之一是:Windows程序是以事件为驱动、消息机制为基础。如何理解?
<BR>举了例子,当你CLICK Windows “开始”BUTTON时,为什么就会弹出一个菜单呢?
<BR>当你单击鼠标左键时,操作系统中与MOUSE相关的驱动程序在第一时间内得到这个信号[LBUTTONDOWN],然后它通知操作系统―――“嗨,鼠标左键被单击了!”,操作系统得到这一信号后,马上要判断――用户单击鼠标左键,这是针对哪个窗口呢?如何判断?这很简单!当前状态中,具有焦点的窗口[或控件]就是了[这里当然是“开始”BUTTON了]。然后操作系统马上向这个窗口发送一条消息到这个窗口所在进程的消息队列,消息内容应是消息本身的代号、附加参数、窗口句柄…等等了。那么,只有操作系统才有资格发送消息至某一窗口的消息队列吗?不然,其它程序也有资格。你可以在你的程序中调用:SendMessage
、PostMessage。这样,被单击的窗口得到了一条由操作系统发送的包含CLICK的消息,操作系统已经暂时不再管窗口的任何事,因为它还要忙于处理其它事务。你的程序得到一条消息后如何做呢?Windows对于你在“开始”BUTTON上的单击事件做出如下反映:弹出一菜单。可是,得到消息到做出反映这一过程是如何实现的呢?这就是本文讨论的主要内容[当然只是针对MFC了]。
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -