How to receive a ClassName and handle(HWND)of a given application and how to hide, show, minimize o
How to receive a ClassName and handle(HWND)of a given application and how to hide, show, minimize or maximize other applications directly from
API Declarations
Private Declare Function GetClassName Lib "user32.dll" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long
Private Declare Function ShowWindow Lib "user32.dll" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Const SW_HIDE = 0
Private Const SW_SHOW = 5
Private Const SW_MAXIMIZE = 3
Private Const SW_MINIMIZE = 6
Private Const SW_NORMAL = 1
Rate How to receive a ClassName and handle(HWND)of a given application and how to hide, show, minimize o
(2(2 Vote))
Dim retval As Long, retval1 As Long
Dim s As String
s = Space(255)
retval = FindWindow(vbNullString, Text1.Text)
retval1 = GetClassName(retval, s, 255)
List1.AddItem "Window name: " & Text1.Text
List1.AddItem "Window Hwnd: " & retval
List1.AddItem "Classname: " & s
List1.AddItem "Characters: " & retval1
End Sub
Private Sub Form_Load()
Command1.Default = True
End Sub
Private Sub Option1_Click(Index As Integer)
Dim retval As Long, retval1 As Long, retval2 As Long
s = Space(255)
retval = FindWindow(vbNullString, Text1.Text)
retval1 = GetClassName(retval, s, 255)
If Option1.Item(0) Then
retval2 = ShowWindow(retval, SW_SHOW)
End If
If Option1.Item(1) Then
retval2 = ShowWindow(retval, SW_MINIMIZE)
End If
If Option1.Item(2) Then
retval2 = ShowWindow(retval, SW_HIDE)
End If
If Option1.Item(3) Then
retval2 = ShowWindow(retval, SW_MAXIMIZE)
End If
End Sub
How to receive a ClassName and handle(HWND)of a given application and how to hide, show, minimize o Comments
No comments yet — be the first to post one!
Post a Comment