how to intercept the 'en_change' windows message?(50分)

  • 主题发起人 主题发起人 sealhy76
  • 开始时间 开始时间
S

sealhy76

Unregistered / Unconfirmed
GUEST, unregistred user!
how to intercept windows message 'en_change'?<br>i use methods as follows:<br>&nbsp; .....<br>&nbsp; procedure my_msg1(var msg1:tmessage);message wm_command;<br>&nbsp; ......<br><br>implementation<br><br>procedure my_msg1(var msg1:tmessage);<br>begin<br>&nbsp; &nbsp; if msg1.lparam=en_change then<br>&nbsp; &nbsp; &nbsp; &nbsp;form1.caption:='ok';<br>&nbsp; &nbsp; inherited;<br>end;<br><br>&nbsp;when i run the program, i change &nbsp;edit1's content, it can go in <br>the procedure my_msg1, but cannot intercept the 'en_change' message.<br>who can help you?<br>&nbsp;<br><br>
 
en_change 是以前vc、bc时候常用的,delphi中少这样用。有可能这个消息已经被vcl处理了。<br>相关的可以使用edit的 OnChange 事件
 
&lt;h2&gt;from msdn:&lt;/h2&gt;<br>The EN_CHANGE notification message is sent when the user has taken an action <br>that may have altered text in an edit control. Unlike the EN_UPDATE notification<br>&nbsp;message, this notification message is sent after the system updates the screen.<br>&nbsp;The parent window of the edit control receives this notification message through <br>the WM_COMMAND message. <br><br>&lt;font style="font-size: 14pt;color: ff00ff"&gt;so you can replace it with en_update and try it again!&lt;/font&gt;
 
<br>你的程序有一个严重错误。<br>通知消息并不是放在 lParam<br>通知代码(比如你的EN_CHANGE)放在msg.WParamHi (wParam高16位)<br>msg.WParamLo (wParam低16位) 放控件id<br>msg.LParam 放的是发消息的控件的HWND<br><br>所以你的程序改为:<br>if msg1.WParamHi=en_change then<br><br>
 
thanks for pipi;
 
后退
顶部