Solved

How to minimize all windows (VB6)

Posted on 2000-03-17
20
342 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
 
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…
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…

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now