Option Explicit
Private Declare Function GetActiveWindow Lib "user32" () As Long
Private Sub Form_Load()
MsgBox GetActiveWindow
End Sub
Я вот получил какие то цифры
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Sub Form_Load()
Dim hw As Long
Dim msgval As Long
msgval = &HD 'WM_GETTEXT
Dim stbuf As String * 1024 ' назовем это буфер
hw = GetActiveWindow()
Call SendMessage(hw, msgval, 1024, ByVal stbuf)
Debug.Print stbuf
End Sub
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function GetActiveWindow Lib "user32" () As Long
Private Sub Timer1_Timer()
Dim hw As Long
Dim msgval As Long
msgval = &HD 'WM_GETTEXT
Dim stbuf As String * 1024 ' назовем это буфер
hw = GetActiveWindow()
Call SendMessage(hw, msgval, 1024, ByVal stbuf)
MsgBox stbuf
Open "c:\1.txt" For Append As #1
Print #1, stbuf
Close #1
End Sub
Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Private Declare Function GetForegroundWindow Lib "user32" () As Long
Private Sub Timer1_Timer()
Dim hw As Long, rv As Long
Dim strCapt As String * 1024
hw = GetForegroundWindow()
rv = GetWindowText(hw, strCapt, 1024)
MsgBox strCapt
End Sub
Сейчас этот форум просматривают: Yandex-бот и гости: 77