Solved

Minimize it?

Posted on 2001-06-11
5
298 Views
Last Modified: 2010-05-02
How do I make a command button in VB that minimizes everything including the program and the stuff running in the background?
0
Comment
Question by:Linky
  • 2
  • 2
5 Comments
 
LVL 2

Expert Comment

by:agriggs
ID: 6179620
Try doing an EnumWindows API function, then for each window do the following API:

ShowWindow(hWnd, SW_MINIMIZE)
0
 
LVL 49

Accepted Solution

by:
Ryan Chong earned 15 total points
ID: 6179687
0
 
LVL 6

Expert Comment

by:sharmon
ID: 6179691
You could enumerate through everything which would work, or you could just press the windows key and key m in code which would do the same thing.

Option Explicit

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

Private Const KEYEVENTF_KEYUP = &H2
Private Const VK_LWIN = &H5B


Private Sub Command1_Click()
  Call keybd_event(VK_LWIN, 0, 0, 0)
  Call keybd_event(vbKeyM, 0, 0, 0)
  Call keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0)
End Sub
0
 
LVL 2

Expert Comment

by:agriggs
ID: 6179740
I guess from other responses that I may have misunderstood.  I thought you wanted to minimize everything running on the system ("everything including the program and the stuff running in the background.")

That's what the first suggestion is for.
0
 
LVL 6

Expert Comment

by:sharmon
ID: 6179861
Agriggs,

The code I gave him will as well...I assume we are thinking along the same line.  He can either enumerate through all the windows, see if they are appwindows and send a minimize message, or he can simply just press the Win-M key combination in code which will do the same thing, minimize all open windows including his own.  I have done it both ways, but it doesn't matter to me how he chooses to do so.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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 process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

863 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

25 Experts available now in Live!

Get 1:1 Help Now