我真不想放弃! 等我真正搞明白了,我再发分,一定很多很多。 (50分)

Unregistered / Unconfirmed
GUEST, unregistred user!
我是初学者,从messages.pas中摘一小段,<br>&nbsp; PMessage = ^TMessage;<br>&nbsp; TMessage = packed record<br>&nbsp; &nbsp; Msg: Cardinal; &nbsp; &nbsp; &nbsp; &nbsp; // 消息ID<br>&nbsp; &nbsp; case Integer of &nbsp; &nbsp; &nbsp; &nbsp;// 此处的Integer针对什么来说的?<br>&nbsp; &nbsp; &nbsp; 0: ( &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 什么时候用到?<br>&nbsp; &nbsp; &nbsp; &nbsp; WParam: Longint; &nbsp;// wparam 在MFC中是什么意思?<br>&nbsp; &nbsp; &nbsp; &nbsp; LParam: Longint; &nbsp;// lparam 在MFC中是什么意思?<br>&nbsp; &nbsp; &nbsp; &nbsp; Result: Longint);<br>&nbsp; &nbsp; &nbsp; 1: ( &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 什么时候用到?<br>&nbsp; &nbsp; &nbsp; &nbsp; WParamLo: Word;<br>&nbsp; &nbsp; &nbsp; &nbsp; WParamHi: Word;<br>&nbsp; &nbsp; &nbsp; &nbsp; LParamLo: Word;<br>&nbsp; &nbsp; &nbsp; &nbsp; LParamHi: Word;<br>&nbsp; &nbsp; &nbsp; &nbsp; ResultLo: Word;<br>&nbsp; &nbsp; &nbsp; &nbsp; ResultHi: Word);<br>&nbsp; end;<br><br>请大家指教,谢谢。<br><br>关于message,欢迎灌水。<br><br><br>
 
有人研究过吗?<br>相关的网址也可以的,谢谢了。
 
呵呵,个人认为会用sendmessage函数就行了,至于具体的情况要具体分析
 
这就是RAD的弊端吧,搞出了一大堆会写华丽界面却不懂message机制的程序员。。学MFC的人就<br>不会了。因为他要自己处理很多消息
 
作为程序员<br>我认为学点VC的,对自己都会有很大的提高,对DELPHI的理解也会加深。。
 
我是初学者,从messages.pas中摘一小段,<br>&nbsp; PMessage = ^TMessage;<br>&nbsp; TMessage = packed record<br>&nbsp; &nbsp; Msg: Cardinal; &nbsp; &nbsp; &nbsp; &nbsp; // 消息ID<br>&nbsp; &nbsp; case Integer of &nbsp; &nbsp; &nbsp; &nbsp;// 此处的Integer针对什么来说的?<br>&nbsp; &nbsp; &nbsp; 0: (<br>&nbsp; &nbsp; &nbsp; &nbsp; WParam: Longint; &nbsp;// wparam 在MFC中是什么意思?<br>&nbsp; &nbsp; &nbsp; &nbsp; LParam: Longint; &nbsp;// lparam 在MFC中是什么意思?<br>&nbsp; &nbsp; &nbsp; &nbsp; Result: Longint);<br>&nbsp; &nbsp; &nbsp; 1: (<br>&nbsp; &nbsp; &nbsp; &nbsp; WParamLo: Word;<br>&nbsp; &nbsp; &nbsp; &nbsp; WParamHi: Word;<br>&nbsp; &nbsp; &nbsp; &nbsp; LParamLo: Word;<br>&nbsp; &nbsp; &nbsp; &nbsp; LParamHi: Word;<br>&nbsp; &nbsp; &nbsp; &nbsp; ResultLo: Word;<br>&nbsp; &nbsp; &nbsp; &nbsp; ResultHi: Word);<br>&nbsp; end;<br><br>请大家指教,谢谢。
 
很难吗?我是不是该放弃研究message?
 
wparam 通常是一个与消息有关的常量值,也可能是窗口或者控件的句柄<br>lparam 通常是一个指向内存中的数据的指针<br>有些东西我不是很清楚,Delphi5开发人员指南里的第五章讲了Windows消息,<br>你可以找来看一下。这本书在大富翁的下载站点里有。不过比较大。85M!<br>呵呵!
 
谢谢halps,我去找找看,如果你知道具体下载地址,请告诉我一下,再谢。
 
我download下来看了,还是不明白上面提到的case integer of的意思,哪位知道的,麻烦<br>告诉我一下。<br>我不相信DFW没有人知道。
 
我敢打赌你没有好好地看过一本Delphi方面比较系统的书!<br>这些东西最好还是去买本书去看好些,不是DFW不懂,是懒得说,因为根本<br>不是三言两语能说得清楚的。
 
to 教父:<br>你说得有点偏激了,我看了,光下面几句代码,就折腾了我好几天,就是不得要领。<br>PMessage = ^TMessage;<br>&nbsp; TMessage = packed record<br>&nbsp; &nbsp; Msg: Cardinal; &nbsp; &nbsp; &nbsp; &nbsp; // 消息ID<br>&nbsp; &nbsp; case Integer of &nbsp; &nbsp; &nbsp; &nbsp;// 此处的Integer针对什么来说的?<br>&nbsp; &nbsp; &nbsp; 0: ( &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br>&nbsp; &nbsp; &nbsp; &nbsp; WParam: Longint; &nbsp;// wparam 是什么意思?<br>&nbsp; &nbsp; &nbsp; &nbsp; LParam: Longint; &nbsp;// lparam 是什么意思?<br>&nbsp; &nbsp; &nbsp; &nbsp; Result: Longint);<br>&nbsp; &nbsp; &nbsp; 1: (<br>&nbsp; &nbsp; &nbsp; &nbsp; WParamLo: Word;<br>&nbsp; &nbsp; &nbsp; &nbsp; WParamHi: Word;<br>&nbsp; &nbsp; &nbsp; &nbsp; LParamLo: Word;<br>&nbsp; &nbsp; &nbsp; &nbsp; LParamHi: Word;<br>&nbsp; &nbsp; &nbsp; &nbsp; ResultLo: Word;<br>&nbsp; &nbsp; &nbsp; &nbsp; ResultHi: Word);<br>&nbsp; end;<br>当然,我问的问题有点广,广得让人不想说。<br>我改。<br>谢谢你提醒。<br>如果有什么好的网址和书籍,麻烦你推荐一下。<br>
 
看来没有人说话啊?咱来说两句<br><br>&gt;&gt;此处的Integer针对什么来说的?<br>这一个语句令下面的两个块作用类似于 C 中的 union<br><br>&gt;&gt; wparam 是什么意思?<br>&gt;&gt; lparam 是什么意思?<br>没有什么特别的意思,变量名而已<br><br>
 
是啊<br>把开发指南好好看看就知道啦<br>有时间就再看看VC
 
这种 case ... of 结构多半是将c++里面的某两种结构改写过来的。<br>没有什么特别的意思,只是区分不同的调用。
 
Object Pascal记录类型中允许包含variant 域,它表示多个域能公用同一内存区,<br>而且域可以是不同类型(这相应于C语言中的联合union)。换句话说,你可以通过<br>variant 域或说是一组域访问记录中同一个内存位置,但是各个值仍需区别对待。<br>具体参见:http://www.marcocantu.com/EPascal/chinese/default.htm<br><br>&nbsp; &nbsp; &nbsp; &nbsp; WParam: Longint; &nbsp;// wparam 是什么意思?<br>&nbsp; &nbsp; &nbsp; &nbsp; LParam: Longint; &nbsp;// lparam 是什么意思?<br>Param的中文意思就是“参数”,前缀表示数据类型,W表示Word类型,那是16位时的<br>后遗症。
 
注意这是在vcl中进行消息派送和处理的结构<br>&nbsp; PMessage = ^TMessage;<br>&nbsp; TMessage = packed record<br>&nbsp; &nbsp; Msg: Cardinal; &nbsp; &nbsp; &nbsp; &nbsp; // 消息ID<br>&nbsp; &nbsp; case Integer of &nbsp; &nbsp; &nbsp; &nbsp;// 在控件dispatch消息的时候用到吧<br>&nbsp; &nbsp; &nbsp; 0: ( &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; //老式表示法,消息没有分解,同mfc中使用函数得到的<br>&nbsp; &nbsp; &nbsp; &nbsp; WParam: Longint; &nbsp;// wparam 在MFC中是消息的字(word 16)字段<br>&nbsp; &nbsp; &nbsp; &nbsp; LParam: Longint; &nbsp;// lparam 在MFC中是消息的长(long 32)字段<br>&nbsp; &nbsp; &nbsp; &nbsp; Result: Longint);<br>&nbsp; &nbsp; &nbsp; 1: ( &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // 新式表示法,已经把消息分解<br>&nbsp; &nbsp; &nbsp; &nbsp; WParamLo: Word;<br>&nbsp; &nbsp; &nbsp; &nbsp; WParamHi: Word;<br>&nbsp; &nbsp; &nbsp; &nbsp; LParamLo: Word;<br>&nbsp; &nbsp; &nbsp; &nbsp; LParamHi: Word;<br>&nbsp; &nbsp; &nbsp; &nbsp; ResultLo: Word;<br>&nbsp; &nbsp; &nbsp; &nbsp; ResultHi: Word);<br>&nbsp; end;<br>可能理解的不是很正确,请指教呀
 
同情,关注!<br><br>大侠们老是说这是什么变体类型。。。。。。这个我们能明白,<br><br>关键是 case Integer of 这一句无法理解,case 语句要求带序数类型的参数,<br>这个 Integer 是如何回事呢?什么时候为 0 ,什么时候为 1 呢?
 
szchengyu 说得对 !关键在 case integer of 0: 1:
 
sorry, i just a RAD ! so poor
 
顶部