くだすれDelphi(超初心者用)その22
■ このスレッドは過去ログ倉庫に格納されています
0166130
05/02/08 21:21:09procedure GetCaretPosEx(var Ps: TPoint);
var
Rect: TRect;
CPos: TPoint;
ActiveWnd: HWND;
hForeground: HWND;
dwFrom, dwTo: DWORD;
begin
ZeroMemory(@Rect, sizeof(Rect));
dwFrom:=GetCurrentThreadId;
hForeground:=GetForegroundWindow;
if hForeground<>HWND(nil) then
dwTo:=GetWindowThreadProcessId(hForeground, nil)
else
dwTo:=HWND(nil);
if (dwFrom and dwTo)<>0 then
begin
if AttachThreadInput(dwFrom, dwTo, true) then
begin
if not(GetCaretPos(CPos)) then
OutputDebugString('失敗');
ActiveWnd:=GetFocus;
if ActiveWnd<>HWND(nil) then
GetWindowRect(ActiveWnd, Rect);
AttachThreadInput(dwFrom, dwTo, false);
end;
end;
Ps.X:=CPos.X+Rect.Left;
Ps.Y:=CPos.Y+Rect.Top;
end;
■ このスレッドは過去ログ倉庫に格納されています