Tiling/cascading Windows Algorithm
Rate Topic:




-
Group:
Member
-
Posts:
586
-
Joined:
19-April 08
Posted 22 April 2009 - 02:18 AM
I am working on a TaskList Docklet which tries to replicate as much as possible the behaviour of the windows taskbar... I am trying to implement the Cascading/stacking of windows that is done via rigth-clicking on an empty area of the Task bar.
Does anyone knows how windows does this? I believe it should use BeginDeferWindowPos/DeferWindowPos/EndDeferWindowPos API calls to reposition all windows simultaneously. First, I was not able to find any conde sample that actually uses them... on the other hand, it stills elude me the actual algorithms used by the taskbar to calculate the new window position of the different shown windows. Does anyone kowns any info on this... I have googled a lot but only found info on MDI child forms.
Thanks.
0
-
Group:
Member
-
Posts:
586
-
Joined:
19-April 08
Posted 22 April 2009 - 06:53 PM
Nevermind I found TileWindows() & CascadeWindows() functions of user32.dll which does the tiling/cascading stuff.
0
-
Group:
Member
-
Posts:
48
-
Joined:
15-June 08
Posted 22 April 2009 - 09:29 PM
Maybe you can also try using the Windows Shell Object, I don't know how to do that with Visual but here an example for Delphi:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Menus;
type
TForm1 = class(TForm)
PopupMenu1: TPopupMenu;
CascadeWindows1: TMenuItem;
ileWindowsHorizontally1: TMenuItem;
ileWindowsVertically1: TMenuItem;
ShowtheDesktop1: TMenuItem;
UndoMinimizeAll1: TMenuItem;
Show1: TMenuItem;
procedure CascadeWindows1Click(Sender: TObject);
procedure UndoMinimizeAll1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure ileWindowsHorizontally1Click(Sender: TObject);
procedure ileWindowsVertically1Click(Sender: TObject);
procedure ShowtheDesktop1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
shell: OleVariant;
implementation
uses ComObj;
{$R *.dfm}
procedure TForm1.CascadeWindows1Click(Sender: TObject);
begin
shell.CascadeWindows;
end;
procedure TForm1.UndoMinimizeAll1Click(Sender: TObject);
begin
shell.UndoMinimizeAll;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
shell:=CreateOleObject('Shell.Application');
end;
procedure TForm1.ileWindowsHorizontally1Click(Sender: TObject);
begin
shell.TileHorizontally
end;
procedure TForm1.ileWindowsVertically1Click(Sender: TObject);
begin
shell.TileVertically
end;
procedure TForm1.ShowtheDesktop1Click(Sender: TObject);
begin
shell.MinimizeAll
end;
end.
0
-
Group:
Member
-
Posts:
586
-
Joined:
19-April 08
Posted 23 April 2009 - 04:06 AM
Thanks for the tip... the shell object includes the undo stuff that I was starting to investigate... thanks again
0