Smaky Posted April 22, 2009 Report Share Posted April 22, 2009 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. Link to comment
Smaky Posted April 22, 2009 Author Report Share Posted April 22, 2009 Nevermind I found TileWindows() & CascadeWindows() functions of user32.dll which does the tiling/cascading stuff. Link to comment
vhanla Posted April 22, 2009 Report Share Posted April 22, 2009 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;interfaceuses 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;implementationuses 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.TileHorizontallyend;procedure TForm1.ileWindowsVertically1Click(Sender: TObject);begin shell.TileVerticallyend;procedure TForm1.ShowtheDesktop1Click(Sender: TObject);begin shell.MinimizeAllend;end. Link to comment
Smaky Posted April 23, 2009 Author Report Share Posted April 23, 2009 Thanks for the tip... the shell object includes the undo stuff that I was starting to investigate... thanks again Link to comment
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now