by Karthikeyan (187 Submissions)
Category: Windows API Call/Explanation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Tue 23rd January 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)
'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
'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
No comments have been posted about 'Get Foreground Window Thread and Process ID using GetWindowThreadProcessId API. Why not be the first to post a comment about 'Get Foreground Window Thread and Process ID using GetWindowThreadProcessId API.