http://www.delphi2007.net/DelphiAPI/html/delphi_20061120145223192.html
已知道 一个窗口的句柄, 如何扑捉该窗口的onresize 事件,并在其中写入自己的代码?
用 SetWindowLong 大概代码如下
Txxxform
function NewWinProc(var Message: TMessage): Integer;
下面代码设成你的处理过程
// NewProc, OldProc: Pointer;
NewProc := WinUtils.MakeObjectInstance(NewWinProc);
OldProc := Pointer(GetWindowLong(你的句柄, GWL_WNDPROC));
SetWindowLong(你的句柄, GWL_WNDPROC, Longint(NewProc));
function xxx.NewWinProc(var Message: TMessage): Integer;
begin
if Message.Msg = WM_SIZE then
begin
...
result := 1;
end
else OldProc(Message);
end;
Hook
本文介绍如何使用Delphi和Windows SDK API通过SetWindowLong函数捕获并处理窗口的OnResize事件,包括如何注册自定义窗口过程以响应WM_SIZE消息。
1250

被折叠的 条评论
为什么被折叠?



