?
Solved

Minimize all windows

Posted on 2000-02-19
13
Medium Priority
?
282 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
[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
  • 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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 400 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses
Course of the Month10 days, 12 hours left to enroll

765 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