procedure TForm1.FormKeyPress(Sender: TObject;
var Key: Char);
begin
if key='1' then
EnableWindow(ChildWindowFromPoint(windowFromPoint(point(Mouse.CursorPos.x,Mouse.CursorPos.y)),point(Mouse.CursorPos.x,Mouse.CursorPos.y)),True);
//?
if key='2' then
EnableWindow(WindowFromPoint(point(Mouse.CursorPos.x,Mouse.CursorPos.y)),False);
key:=#0;
end;
我昨天试过windows.screentoclient,好象不行来着,唉,昏了头了。
改成:
procedure TForm1.FormKeyPress(Sender: TObject;
var Key: Char);
var i:HWND;
mypoint:tpoint;
begin
i:=windowFromPoint(point(Mouse.CursorPos.x,Mouse.CursorPos.y));
mypoint:=point(Mouse.CursorPos.x,Mouse.CursorPos.y);
windows.ScreenToClient(i,mypoint);
if key='1' then
EnableWindow(ChildWindowFromPoint(i,mypoint),True);
if key='2' then
EnableWindow(i,False);
key:=#0;
end;