Solved

How to minimize all windows (VB6)

Posted on 2000-03-17
20
402 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Creating Instructional Tutorials  

For Any Use & On Any Platform

Contextual Guidance at the moment of need helps your employees/users adopt software o& achieve even the most complex tasks instantly. Boost knowledge retention, software adoption & employee engagement with easy solution.

 
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 100 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month8 days, 3 hours left to enroll

617 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