VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Update Close Window (partial title)

Che  (2 Submissions)   Miscellaneous   Visual Basic 3.0   Beginner   Wed 3rd February 2021

This will get the hWnd of freaky programs that change class names every time you start it, and then close it. The only thing you need to know is part of the Titlename (Netsc, instead of "Web Page Title" - Netscape). This WILL close Microsoft Internet Explorer (old version wouldn't) now =Þ. Also, I made it so that you don't have to have a form named "Form1" (by using EnumWindows)

API Declarations
Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As Long) As Long
Declare Function getwindow Lib "user32" Alias "GetWindow" (ByVal hwnd As Long, ByVal wCmd 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 GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Declare Function EnumWindows& Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long)
Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Const WM_CLOSE = &H10
Public AppTitle As String
Public ApphWnd As Long

Rate Update Close Window (partial title) (7(7 Vote))
Update Close Window (partial title).bas

Update Close Window (partial title) Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters