How do get the hwnd of a window like notepad, internet explorer (even if the programs are not running)
Actually, I want to change the menu of ie. So I need the hwnd of ie even if it is running at that time or not.
Printable View
How do get the hwnd of a window like notepad, internet explorer (even if the programs are not running)
Actually, I want to change the menu of ie. So I need the hwnd of ie even if it is running at that time or not.
Use the FindWindow API function.
VB Code:
Private Declare Function FindWindow Lib "user32" _ Alias "FindWindowA" (ByVal lpClassName As String, ByVal _ lpWindowName As String) As Long Private Sub Command1_Click() Dim hWin As Long hWin = FindWindow("IEFrame", vbNullString) If hWin <> 0 Then Msgbox "Window hwnd: " & hWin Else Msgbox "Window hwnd: " & hWin '0 End If End Sub