挂接桌面窗口wndproc

  • 主题发起人 主题发起人 import
  • 开始时间 开始时间
I

import

Unregistered / Unconfirmed
GUEST, unregistred user!
我是着帮你用修改DeskTopWindow的窗口过程。但没成功。 OldWndProc: function(h: hwnd; m: tmsg; w: wparam; l: lparam): integer; stdcall;
function NewWndProc(h: hwnd; m: tmsg; w: wparam; l: lparam): integer; stdcall;
var
hdc: Integer;
begin
Result := OldWndProc(h,m,w,l);
if h=WM_PAINT then
begin
hdc := GetDC(h);
Rectangle(hdc,100,100,300,300);
ReleaseDC(h,hdc);
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
var
hwnd: Integer;
retv: Integer;
begin
hwnd := GetDeskTopWindow;
OldWndProc := Pointer(GetWindowLong(hwnd,GWL_WNDPROC));
retv := SetWindowLong(hwnd,GWL_WNDPROC,Integer(@NewWndProc));
end; //retv 老是为零
procedure TForm1.FormDestroy(Sender: TObject);
var
hwnd: Integer;
retv: Integer;
begin
hwnd := GetDeskTopWindow;
retv := SetWindowLong(hwnd,GWL_WNDPROC,Integer(@OldWndProc));
end;
 

Similar threads

后退
顶部