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..
In a Form..Code: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
------------------Code:Private Sub Command1_Click() Call EnumWindows(AddressOf EnumProc, 0) End Sub
Aaron Young
Analyst Programmer
[email protected]
[email protected]




Reply With Quote