[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Minimize all windows

Posted on 2000-02-19
13
Medium Priority
?
284 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

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

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…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

656 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