PDA

Click to See Complete Forum and Search --> : Minimaze All


Aaron Young
Dec 4th, 1999, 07:02 AM
I'm sure there's a much simpler way to do this, but I can't think of it off the top of my head, although this will do the job..

In a Module..

Public Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long

Private Const WS_MINIMIZEBOX = &H20000
Private Const SW_MINIMIZE = 6
Private Const GWL_STYLE = (-16)

Public Function EnumProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
'Make sure the Window is Visible and Minimizable..
If IsWindowVisible(hwnd) Then
If (GetWindowLong(hwnd, GWL_STYLE) And WS_MINIMIZEBOX) = WS_MINIMIZEBOX Then
'Minimize it
Call ShowWindow(hwnd, SW_MINIMIZE)
End If
End If
EnumProc = hwnd
End Function

In a Form..

Private Sub Command1_Click()
Call EnumWindows(AddressOf EnumProc, 0)
End Sub


------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
adyoung@win.bright.net

LG
Dec 4th, 1999, 09:41 AM
Thank you, it works just fine.
LG

LG
Dec 4th, 1999, 11:15 AM
When My application starts, I would like to minimize all previously opened by user applications.
How can i do that?