How to minimize all windows (VB6)

I would like to minimize all windows on my screen just like i.e explorer.  I found an answer from BillyBob that works for everything but... it won't work for an application that has forms that are fixed single, and do not have the minimize option turned on.  Is there a way to get these applications to minimize also when running this module.  HELP!
dorindaAsked:
Who is Participating?
 
AzraSoundConnect With a Mentor Commented:
i think your one solution would be to use the code to minimize all windows using the code that you have now, and any window that is a fixed dialog, you should do it manually with
Form.WindowState = 1
0
 
RuchiCommented:
go to
http://www.vbsquare.com/tips/tip386.html

http://www.vbwm.com/tips/tips54.htm



'How to minimize all active windows in application

'make a MDIform with several child forms
'and a menu on the MDI form with two options:
'mnuWindows.caption = "minimize"
'index = 1
'mnuWindows.caption = "restore"
'index = 2

'Put the next code on the right place and press F5

Sub mnuWindows_Click(Index as integer)
    Select Case Index
    Case 1
    'minimize
    For t% = 1 To Forms.Count - 1
        Forms(t%).WindowState = 1
    Next t%
    Case 2
    'restore
    For t% = 1 To Forms.Count - 1
        Forms(t%).WindowState = 0
    Next t%
    End Select
End Sub

0
 
dorindaAuthor Commented:
I want to minimize ALL applications on my desktop, not just one application and all its windows.
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
RuchiCommented:
0
 
AzraSoundCommented:
by setting the window property to a type like fixed dialog then all of these api calls and such that I've seen wont work because they rely on that button being present.
0
 
dorindaAuthor Commented:
Almost. The ShowWindow example works for everything on the taskbar, but what if I have an exe that is running that is not on the taskbar?
0
 
RuchiCommented:
Another question ;-)
Hmmm.. I could not figure it out.
0
 
AzraSoundCommented:
Are there other programs other than those you have written that arent in the taskbar? if not then as I said before itd be simple to set the windowstate to 1 in your function that is calling all windows to minimize
0
 
wsh2Commented:
Modal forms will not minimize.. the best you could do with them is subclass and hide.. <smile>
0
 
wsh2Commented:
And.. You may want to give this a try..

Private Declare Sub keybd_event Lib "user32" ( _
  ByVal bVk As Byte, _
  ByVal bScan As Byte, _
  ByVal dwFlags As Long, _
  ByVal dwExtraInfo As Long)

  Const KEYEVENTF_KEYUP = &H2
  Const VK_LWIN = &H5B

Private Sub Command1_Click()

  ' 77 is the character code for the letter 'M'
  Call keybd_event(VK_LWIN, 0, 0, 0)

  Call keybd_event(77, 0, 0, 0)

  Call keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0)

End Sub
0
 
RuchiCommented:
Do search "Minimize all windows" Many questions are similiar to yours.

From q.10247671

Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Const KEYEVENTF_KEYUP = &H2
Const VK_LWIN = &H5B

' 77 is the character code for the letter 'M'
Call keybd_event(VK_LWIN, 0, 0, 0)
Call keybd_event(77, 0, 0, 0)
Call keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0)
0
 
jkunalCommented:
Dim myWindow
For Each myWindow in Application.Windows
   gethandle()
   closewindow()
Next

do you want to try something like this?

0
 
wsh2Commented:
Ruchi:
<laughing>.. take a look at the comment right above yours.. <smile> and a <wink>.
0
 
RuchiCommented:
wsh2 ... LOL!! Sorry about that...
0
 
wsh2Commented:
Ruchi:
All is well.. we late night VB Zombies gotta stick together.. "Would you like more coffee, Sir?".. <lol> and a <smile>.
0
 
NazdorCommented:
Just a thought - if you're trying to minimise your windows simply to get at the icons on the desktop, how about just opening the desktop in a new window?

eg (win98), Start->Run: C:\Windows\Desktop

Or put a shortcut to C:\Windows\Desktop on the Startmenu and assign a shortcut key to it.

I know this is a VB question, but perhaps this will help in some way.

0
 
RuchiCommented:
Wsh2: You should ask me instead.
"Would you like more coffee, Madam?" :-)
0
 
wsh2Commented:
Ruchi:
Oh my goodness.. <blush> <blush>.. <tipping backwardz baseball cap and bowing>.. "Two lumps or one, Ma'am?".. <smile>.
0
 
RuchiCommented:
Dorinda: Where are you?
0
 
dorindaAuthor Commented:
Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.