Link to home
Start Free TrialLog in
Avatar of scvb
scvb

asked on

Q: How to minimise all open windows

Hi,
Can some kind soul please let me know how to minimise all open windows on the desktop.

(VB5/SP3 / WIN95/98)

Many thanks.
   Tony
Avatar of wiltonk
wiltonk

You could try the following code:

Dim frm as Form

For Each frm In Forms
   frm.WindowState = vbMinimized
Next frm


This program scan through all forms in the desktop and minimize them.
Avatar of scvb

ASKER

I may have misphrased my question ...

I want to minimise all open PROGRAM windows on the desktop. Your sample will work well if only my app's forms needed to be minned, but not other (external) apps.

Looking forward to hearing from you.

Regards,
   Tony

ASKER CERTIFIED SOLUTION
Avatar of peterwest
peterwest

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Ooops!!!

Sorry, I accidentally missed out the 'preserve' keyword in the redim statement about half way through the main routine.  Just change the line:

ReDim lMinimList(UBound(lMinimList) + 1)

to read

ReDim Preserve lMinimList(UBound(lMinimList) + 1)

and everything should be fine!!!

Sorry 'bout that!!

Pete

Avatar of scvb

ASKER

Thanks very much indeed. Yes, the Redim statement fixed it!!
Brilliant answer!

All the best.

Kind regards,
    Tony Jones
    Southern Cross Visual Basic Code and Links
    http://www.geocities.com/capecanaveral/6740/index.html