关于TMessage的定义(50分)

  • 主题发起人 主题发起人 killme
  • 开始时间 开始时间
K

killme

Unregistered / Unconfirmed
GUEST, unregistred user!
请用汉语解释一下:<br>type <br>&nbsp; TMessage = packed record<br>&nbsp; &nbsp; Msg: Cardinal;<br>&nbsp; &nbsp; case Integer of<br>&nbsp; &nbsp; &nbsp; 0: (<br>&nbsp; &nbsp; &nbsp; &nbsp; WParam: Longint;<br>&nbsp; &nbsp; &nbsp; &nbsp; LParam: Longint;<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>case Integer of是怎么一会事?<br>
 
delphi help里有,我想应该是E文的。
 
请参照system.pas中230行<br>&nbsp; TVarData = packed record<br>&nbsp; &nbsp; VType: Word;<br>&nbsp; &nbsp; Reserved1, Reserved2, Reserved3: Word;<br>&nbsp; &nbsp; case Integer of<br>&nbsp; &nbsp; &nbsp; varSmallint: (VSmallint: Smallint);<br>&nbsp; &nbsp; &nbsp; varInteger: &nbsp;(VInteger: Integer);<br>&nbsp; &nbsp; &nbsp; varSingle: &nbsp; (VSingle: Single);<br>&nbsp; &nbsp; &nbsp; varDouble: &nbsp; (VDouble: Double);<br>&nbsp; &nbsp; &nbsp; varCurrency: (VCurrency: Currency);<br>&nbsp; &nbsp; &nbsp; varDate: &nbsp; &nbsp; (VDate: Double);<br>&nbsp; &nbsp; &nbsp; varOleStr: &nbsp; (VOleStr: PWideChar);<br>&nbsp; &nbsp; &nbsp; varDispatch: (VDispatch: Pointer);<br>&nbsp; &nbsp; &nbsp; varError: &nbsp; &nbsp;(VError: LongWord);<br>&nbsp; &nbsp; &nbsp; varBoolean: &nbsp;(VBoolean: WordBool);<br>&nbsp; &nbsp; &nbsp; varUnknown: &nbsp;(VUnknown: Pointer);<br>&nbsp; &nbsp; &nbsp; varByte: &nbsp; &nbsp; (VByte: Byte);<br>&nbsp; &nbsp; &nbsp; varString: &nbsp; (VString: Pointer);<br>&nbsp; &nbsp; &nbsp; varAny: &nbsp; &nbsp; &nbsp;(VAny: Pointer);<br>&nbsp; &nbsp; &nbsp; varArray: &nbsp; &nbsp;(VArray: PVarArray);<br>&nbsp; &nbsp; &nbsp; varByRef: &nbsp; &nbsp;(VPointer: Pointer);<br>&nbsp; end;
 
case语句<br>TMessage是一个记录类型,Msg是不可变部分,<br>下面为可变部分;<br>详情请参阅Delphi帮助文档 <br>Variant parts in records
 
是变体记录了,查一下PASCAL手册应能找到
 
有 case Integer of 的 record 类似 C 里面的 union 类型<br>至于每一成员的具体意思是由具体的消息定义的,不同的消息对他们有不同的定义。
 
记录的变体,任何一本pascal语言的书上都有。
 
后退
顶部