procedure TForm1.Timer1Timer(Sender: TObject);var t:tpoint;
hWnd,ParentHand:THandle;
R:TRect;
dThreadID,sThreadID
WORD;
begin
ParentHand:=windows.GetForegroundWindow;//当前活动form的句柄 sThreadID := GetCurrentThreadId();
dThreadID := GetWindowThreadProcessId(ParentHand, NIL);
AttachThreadInput(dThreadID, sThreadID, true);
hWnd := GetFocus();
GetCaretPos(t);
windows.GetWindowRect(hWnd,R);
//当前活动form中,焦点所在window,在桌面中的位置 caption:=format('光标位置:%d %d',[R.Left+t.x, r.Top+t.y]);
end;
我不补充了,呵呵