Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How to minimize all windows (VB6)

Posted on 2000-03-17
20
Medium Priority
?
449 Views
Last Modified: 2008-02-01
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!
0
Comment
Question by:dorinda
  • 7
  • 5
  • 3
  • +3
20 Comments
 
LVL 9

Expert Comment

by:Ruchi
ID: 2629792
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
 

Author Comment

by:dorinda
ID: 2629803
I want to minimize ALL applications on my desktop, not just one application and all its windows.
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2629831
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 28

Expert Comment

by:AzraSound
ID: 2629850
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
 
LVL 28

Accepted Solution

by:
AzraSound earned 300 total points
ID: 2629858
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
 

Author Comment

by:dorinda
ID: 2629898
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
 
LVL 9

Expert Comment

by:Ruchi
ID: 2629926
Another question ;-)
Hmmm.. I could not figure it out.
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2629998
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
 
LVL 14

Expert Comment

by:wsh2
ID: 2630009
Modal forms will not minimize.. the best you could do with them is subclass and hide.. <smile>
0
 
LVL 14

Expert Comment

by:wsh2
ID: 2630035
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
 
LVL 9

Expert Comment

by:Ruchi
ID: 2630676
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
 
LVL 4

Expert Comment

by:jkunal
ID: 2630693
Dim myWindow
For Each myWindow in Application.Windows
   gethandle()
   closewindow()
Next

do you want to try something like this?

0
 
LVL 14

Expert Comment

by:wsh2
ID: 2630774
Ruchi:
<laughing>.. take a look at the comment right above yours.. <smile> and a <wink>.
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2630804
wsh2 ... LOL!! Sorry about that...
0
 
LVL 14

Expert Comment

by:wsh2
ID: 2630845
Ruchi:
All is well.. we late night VB Zombies gotta stick together.. "Would you like more coffee, Sir?".. <lol> and a <smile>.
0
 
LVL 4

Expert Comment

by:Nazdor
ID: 2633702
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
 
LVL 9

Expert Comment

by:Ruchi
ID: 2637789
Wsh2: You should ask me instead.
"Would you like more coffee, Madam?" :-)
0
 
LVL 14

Expert Comment

by:wsh2
ID: 2637821
Ruchi:
Oh my goodness.. <blush> <blush>.. <tipping backwardz baseball cap and bowing>.. "Two lumps or one, Ma'am?".. <smile>.
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2663006
Dorinda: Where are you?
0
 

Author Comment

by:dorinda
ID: 2665288
Thanks
0

Featured Post

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question