GetWindowText API を使用して、すべてのウィンドウのテキストを取得できます。マウスの位置は、GetCursorPos API で見つけることができます。
Delphi では、この関数を使用できます (下の Peter に敬意を表します)。
Function ChildWindowUnderCursor: HWND;
Var
hw, lasthw: HWND;
pt, clientpt: TPoint;
Begin
Result := 0;
GetCursorPos( pt );
// find top-level window under cursor
hw := WindowFromPoint( pt );
If hw = 0 Then Exit;
// look for child windows in the window recursively
// until we find no new windows
Repeat
lasthw := hw;
clientpt := Pt;
Windows.ScreenToClient( lasthw, clientpt );
// Use ChildwindowfromPoint if app needs to run on NT 3.51!
hw := ChildwindowFromPointEx( lasthw, clientpt, CWP_SKIPINVISIBLE );
Until hw = lasthw;
Result := hw;
End;
よろしく、
リーベン