'Get Foreground Window Thread and Process ID using GetWindowThreadProcessId API
'Get Foreground Window Thread and Process ID using GetWindowThreadProcessId API
API Declarations
Private Declare Function GetForegroundWindow Lib "user32" () As Long
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Rate 'Get Foreground Window Thread and Process ID using GetWindowThreadProcessId API
(1(1 Vote))
'http://www.geocities.com/marskarthik
'http://marskarthik.virtualave.net
'Email: [email protected]
Private Sub Form_Load()
'Set window on top of all
SetWindowPos Me.hwnd, -1, 0, 0, 0, 0, 1
Timer1.Enabled = True
Timer1.Interval = 100
End Sub
Private Sub Timer1_Timer()
Dim processID As Long
Label1.Caption = "ThreadID = " & Hex(GetWindowThreadProcessId(GetForegroundWindow(), processID)) _
& Chr(13) & " ProcessID = " & Hex(processID)
End Sub
'Get Foreground Window Thread and Process ID using GetWindowThreadProcessId API Comments
No comments yet — be the first to post one!
Post a Comment