Hallo Ma-gic
Den Fokus abfragen habe ich mit diesen API's erreicht.
Private Type POINTAPI
x As Long
y As Long
End Type
Private Type POINTL
x As Long
y As Long
End Type
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Private Declare Function SendMessageSTRING Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Private Sub tmrRefresh_Timer()
Dim cursorPos As POINTAPI ', textLength As Integer
Dim hwnd As Long ', winText As String
Dim lNewHwnd As Long
Dim P As POINTL ', lNotepadEdit As Long
Dim sCaption As String * 256 '// YES A BUFFER
Static prevHWnd As Long 'Store handle of previous Window
Call GetCursorPos(cursorPos) 'Get current mouse position
hwnd = WindowFromPoint(cursorPos.x, cursorPos.y) 'Get handle To Window mouse is over
If prevHWnd <> hwnd Then 'If the Window mouse is the same as the previous Window that the mouse was over, don't refresh the information
SendMessageSTRING hwnd, WM_GETTEXT, 256, sCaption
txtHWnd.Text = sCaption
prevHWnd = hwnd
End If
End Sub
Diese hwnd' ist der Fokus der anderen Anwendung.
Ich hoffe, ich habe Dich richtig verstanden.
ANI
