windows消息问题(30分)

  • 主题发起人 主题发起人 ly_qiangzhen
  • 开始时间 开始时间
L

ly_qiangzhen

Unregistered / Unconfirmed
GUEST, unregistred user!
procedure Tform1.WMSysCommand(var Msg: TWMSysCommand);<br>begin<br>&nbsp;inherited;<br>&nbsp;if (msg.cmdtype=sc_maximize) or (msg.cmdtype=sc_minimize) or (msg.cmdtype=sc_restore) then<br>&nbsp;begin<br>&nbsp; ....<br>&nbsp;end;<br>end;<br>为什么以上这程序不能截获双击窗口标题栏最大化或恢复窗口大小,但能能截获窗口的最大化或恢复按钮消息。要截获双击窗口标题栏该如何?
 
unit Unit1;<br><br>interface<br><br>uses<br>&nbsp; Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,<br>&nbsp; Dialogs;<br><br>type<br>&nbsp; TForm1 = class(TForm)<br>&nbsp; private<br>&nbsp; &nbsp; { Private declarations }<br>&nbsp; public<br>&nbsp; &nbsp; { Public declarations }<br>&nbsp; protected<br>&nbsp; &nbsp; procedure WMNCLButtonDblClk(var Message : TWMNCLButtonDblClk); message WM_NCLBUTTONDBLCLK;<br>&nbsp; end;<br><br>var<br>&nbsp; Form1: TForm1;<br><br>implementation<br><br>{$R *.dfm}<br><br>{ TForm1 }<br><br>procedure TForm1.WMNCLButtonDblClk(var Message: TWMNCLButtonDblClk);<br>begin<br>&nbsp; if (Message.HitTest = HTCAPTION) then<br>&nbsp; &nbsp; ShowMessage('截获双击标题栏消息')<br>&nbsp; else<br>&nbsp; &nbsp; inherited; &nbsp;{Call default processing.}<br>end;<br><br>end.<br>
 
同意楼上,标题栏消息都是WM_NC开头的
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
588
import
I
I
回复
0
查看
642
import
I
后退
顶部