Click to See Complete Forum and Search --> : finding a window
abdul
Jul 21st, 2001, 11:26 PM
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.
Matthew Gates
Jul 21st, 2001, 11:33 PM
Use the FindWindow API function.
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
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.