Solved

Minimize all windows

Posted on 2000-02-19
13
279 Views
Last Modified: 2010-04-04
Hi!

i like to do something speecial in my app, !

How can i minimize all windows?

Karen
0
Comment
Question by:karen021897
  • 3
  • 3
  • 2
  • +4
13 Comments
 
LVL 17

Expert Comment

by:inthe
ID: 2539038
Hi
how about this one:

 function NextWindow (Wnd : HWnd;Form : TForm1) : Boolean; export; {$ifdef Win32} stdcall; {$endif}
begin
  ShowWindow (Wnd, SW_MINIMIZE);
  NextWindow := true; { next window, please }
end;

procedure TForm1.Sample;
var
  EnumProc: TFarProc;
begin
  { this works in Win32 }
  EnumWindows(@NextWindow,LongInt(Self));

  { MakeProcInstance for Win16 }
  EnumProc := MakeProcInstance(@NextWindow, HInstance);
  EnumWindows (EnumProc, 0);
  FreeProcInstance(EnumProc);
end;
 

 Regards Barry
0
 
LVL 17

Expert Comment

by:inthe
ID: 2539042
DO NOT TRY ABOVE CODE!!
well expect not good results need to take out some windows first.
back soon.
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2539088
Use this:

function NextWindow(Wnd: HWND; param: Cardinal): Boolean; stdcall;
var parent: HWND;
begin
  parent := GetWindow(Wnd, GW_OWNER);
  if (parent = 0) and (IsWindowVisible(wnd)) then
    ShowWindow(wnd, SW_MINIMIZE);
  Result := true;
end;





Btw: There is another way by simulating the Windows+m key press....
0
Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

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.

 
LVL 17

Expert Comment

by:inthe
ID: 2539094
yep epsylon has the idea using iswindowvisible etc..

there is also another way using a toolhelp snapshot but it wont work on all systems.

0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2539109
Create a file 'minimize.scf' with these contents:

[Shell]
Command=2
IconFile=explorer.exe,3

[Taskbar]
Command=ToggleDesktop


Then use

ShellExecute(0, 'open', 'minimize.scf', nil, nil, SW_HIDE);

to minimize all windows.
0
 
LVL 3

Expert Comment

by:bryan7
ID: 2539313
listenning
0
 
LVL 6

Expert Comment

by:DrDelphi
ID: 2539485
Try my TWindowWorks component:

http://www.drdelphi.com/delphi/right/comp.html


Good luck!!

0
 
LVL 20

Accepted Solution

by:
Madshi earned 100 total points
ID: 2539937
This does exactly what Window does:

procedure Shell_MinimizeAllWindows;
var V : Variant;
begin
  V := CreateOleObject('Shell.Application');
  V.MinimizeAll;
end;

But I think it works only with win98 & win2000, or with win95 & NT4 with installed IE4 with system extensions.

Regards, Madshi.
0
 
LVL 20

Expert Comment

by:Madshi
ID: 2539940
P.S: I think you need D3-D5 for this to work and add "ComObj" to your uses clause.
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2547272
Karen?
0
 
LVL 2

Expert Comment

by:Ten13
ID: 2551512
Hi Karen

If you have an Windows keyboard with those special windows keys, you can press "winkey+M" to minimize all windows and "winkey+shift+M" to undo minimize all windows. Theese two key press you can emulate with this code:

  (* clear distracting keys *)
  keybd_event(VK_MENU,    $00, KEYEVENTF_KEYUP,  0);
  keybd_event(VK_CONTROL, $9D,
              KEYEVENTF_EXTENDEDKEY or KEYEVENTF_KEYUP, 0);

  if MinimizeAllWindows then begin
    (* minimize all windows *)
    keybd_event(VK_RWIN,    $00,
                KEYEVENTF_EXTENDEDKEY | 0,               0);
    keybd_event(0x4D,       $00,
                0,                                       0);
    keybd_event(0x4D,       $00,
                KEYEVENTF_KEYUP,                         0);
    keybd_event(VK_RWIN,    $00,
                KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
  end
  else begin
    (*undo minimize all windows *)
    keybd_event(VK_RWIN,    0x00,
                KEYEVENTF_EXTENDEDKEY | 0,               0);
    keybd_event(VK_SHIFT,   0x00,
                0,                                       0);
    keybd_event(0x4D,       0x00,
                0,                                       0);
    keybd_event(0x4D,       0x00,
                KEYEVENTF_KEYUP,                         0);
    keybd_event(VK_SHIFT,   0x00,
                KEYEVENTF_KEYUP,                         0);
    keybd_event(VK_RWIN,    0x00,
                KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, 0);
  end;
0
 

Author Comment

by:karen021897
ID: 2562350
I'am going to use Madshi code, so Madshi get the points

thanx
Karen
0
 

Author Comment

by:karen021897
ID: 2562351
good idea...
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

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

Suggested Solutions

Title # Comments Views Activity
how to center only a line in richedit? 4 62
QRReport  TQrmemo vertical stretching 1 53
Convert GUI app into console app for Win32 Env 5 110
RESTRequest Parameter 4 43
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

821 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