I have seen this code below
Dim MyStr As String, theHwnd As Long
'Create a buffer
theHwnd = GetForegroundWindow()
MyStr = String(GetWindowTextLength(theHwnd) + 1, Chr$(0))
'Get the window's text
GetWindowText theHwnd, MyStr, Len(MyStr)
Me.Caption = MyStr
I would like to ask if theHwnd is the other application's window or this application that executes this code?
Dim MyStr As String, theHwnd As Long
'Create a buffer
theHwnd = GetForegroundWindow()
MyStr = String(GetWindowTextLength(theHwnd) + 1, Chr$(0))
'Get the window's text
GetWindowText theHwnd, MyStr, Len(MyStr)
Me.Caption = MyStr
I would like to ask if theHwnd is the other application's window or this application that executes this code?