Default
Google

How can I minimize all windows?

Applies To: C++Builder 1 or higher
Category: Knowledge Base

The standard way to minimize all windows is to left click on the taskbar, then from the pop-up menu to choose Minimize All Windows and finally to close the pop-up menu. How can I do this by code?
 
 1.
  Start a new project using File | New Application.
 
 2.
  Add a Button. Edit its OnClick event:
 
void __fastcall TForm1::Button1Click(TObject *Sender)
{
    keybd_event(VK_LWIN, 0, 0, 0);
    keybd_event('M', 0, 0, 0);
    keybd_event(VK_LWIN, 0, KEYEVENTF_KEYUP, 0);
}
 
The Win32 API function keybd_event allows you to send keys to another application.

C++Builder Developer's Network
Copyright © Yoto Yotov



Acquiring image from ProHosting Banner Exchange