Results 1 to 4 of 4

Thread: Minimaze All

  1. #1

    Thread Starter
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

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

  2. #2
    Hyperactive Member
    Join Date
    Jun 1999
    Posts
    308

    Post

    Thank you, it works just fine.
    LG

  3. #3
    Hyperactive Member
    Join Date
    Jun 1999
    Posts
    308

    Post

    When My application starts, I would like to minimize all previously opened by user applications.
    How can i do that?

  4. #4
    Hyperactive Member
    Join Date
    May 2018
    Location
    Russia
    Posts
    343

    Re: Minimaze All

    Or just:

    Code:
       Call CreateObject("Shell.Application").MinimizeAll
       Call CreateObject("WScript.Shell").Popup("Hello, world!")
       Call CreateObject("Shell.Application").UndoMinimizeAll

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width