I guess what i need is the hWnd of another programs form using api. what i am doing is, making a program that searches for NetZero's banner, and will make it invisible. But, i'm not sure about how i would do this. any help is great. thanks!
Printable View
I guess what i need is the hWnd of another programs form using api. what i am doing is, making a program that searches for NetZero's banner, and will make it invisible. But, i'm not sure about how i would do this. any help is great. thanks!
Private Declare Function GetForegroundWindow Lib "user32" () As Long
Declare Function GetParent Lib "user32" (ByVal hwnd As Long) As Long
Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Function GetActiveWindowTitle(ByVal ReturnParent As Boolean) As String
Dim i As Long
Dim j As Long
i = GetForegroundWindow
If ReturnParent Then
Do While i <> 0
j = i
i = GetParent(i)
Loop
i = j
End If
GetActiveWindowTitle = GetWindowTitle(i)
End Function
Public Function GetWindowTitle(ByVal hwnd As Long) As String
Dim l As Long
Dim s As String
l = GetWindowTextLength(hwnd)
s = Space(l + 1)
GetWindowText hwnd, s, l + 1
GetWindowTitle = Left$(s, l)
End Function
' GetActiveWindowTitle Will get you the name of the active window.
'then u can use :
windowHandle = FindWindow(vbNullString,GetActiveWindowTitle(False))