* Ultimate Window Handler! *

By | 2002-06-01

This is the ultimate window handler. This can
*Hide a window*
*Show a window*
*Minimize Window*
*Maximize Window*
*Close Window*

Original Author: Matt Evans

API Declarations

Declare Function SendMessageByString Lib “user32” Alias “SendMessageA” (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Declare Function SendMessage Lib “user32” Alias “SendMessageA” (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Long) As Long
Public Const WM_CLOSE = &H10
Public Const SW_HIDE = 0
Public Const SW_MAXIMIZE = 3
Public Const SW_SHOW = 5
Public Const SW_MINIMIZE = 6

Code

Sub WindowHandle(win,cas as long)
'by storm
'Case 0 = CloseWindow
'Case 1 = Show Win
'Case 2 = Hide Win
'Case 3 = Max Win
'Case 4 = Min Win
Select Case cas
Case 0:
Dim X%
X% = SendMessage(win, WM_CLOSE, 0, 0)
Case 1:
X = ShowWindow(win, SW_SHOW)
Case 2:
X = ShowWindow(win, SW_HIDE)
Case 3:
X = ShowWindow(win, SW_MAXIMIZE)
Case 4:
X = ShowWindow(win, SW_MINIMIZE)
End Select
'any questions e-mail me at storm@n2.com
End Sub

Author: dwirch

Derek Wirch is a seasoned IT professional with an impressive career dating back to 1986. He brings a wealth of knowledge and hands-on experience that is invaluable to those embarking on their journey in the tech industry.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.