rafaelrgl
asked on
Form on taskbar (Like Windows MediaPlayer)
I am writing a small app and wondering how i can create a little form or something on the taskbar where i can put buttons and other things. Similar to windows media player when you can minimise it and it displays on the task bar.
ASKER
It shows on the left side, and I would like to show on the right side of the taskbar like widows media player.
well just move it to the place you want it. (I don't use media player so I don't know what minimization you are talking about ;-) )
var f:tform; taskbar:hwnd; r:trect;
begin
taskbar:=findwindow('Shell _TrayWnd', nil);
f:=tform.CreateParented(ta skbar);
SetWindowLong( f.Handle, // hide captionbar
GWL_STYLE,
GetWindowLong( f.Handle, GWL_STYLE )
and not WS_CAPTION ) ;
f.ClientHeight := f.Height;
GetWindowRect(FindWindowEx (taskbar,0 ,'TrayNoti fyWnd',NIL ),r);
f.Left:=r.Left-f.Width;
f.Show;
end;
this will place the form just before the tray. guess this is what you want. if not ... maybe a screen shot or some indications of how to achieve this? I have media player that ships with windows xp sp1.
var f:tform; taskbar:hwnd; r:trect;
begin
taskbar:=findwindow('Shell
f:=tform.CreateParented(ta
SetWindowLong( f.Handle, // hide captionbar
GWL_STYLE,
GetWindowLong( f.Handle, GWL_STYLE )
and not WS_CAPTION ) ;
f.ClientHeight := f.Height;
GetWindowRect(FindWindowEx
f.Left:=r.Left-f.Width;
f.Show;
end;
this will place the form just before the tray. guess this is what you want. if not ... maybe a screen shot or some indications of how to achieve this? I have media player that ships with windows xp sp1.
ASKER
can you take a look to windows media player, you will see what I am talking about. It's great that application.
ASKER
well the code I last posted does that. whyy is it not good?
ASKER
you're doing something wrong. create a new application, put that code at a button click. start the app, click the button: it will show it on the taskbar. don't modify that code in any way or you will introduce bugs. teh code, as it is works like a charm.
this is my test app unit I just made for a doublecheck:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender : TObject);
var f:tform; taskbar:hwnd; r:trect;
begin
taskbar:=findwindow('Shell _TrayWnd', nil);
f:=tform.CreateParented(ta skbar);
SetWindowLong( f.Handle, // hide captionbar
GWL_STYLE,
GetWindowLong( f.Handle, GWL_STYLE )
and not WS_CAPTION ) ;
f.ClientHeight := f.Height;
GetWindowRect(FindWindowEx (taskbar,0 ,'TrayNoti fyWnd',NIL ),r);
f.Left:=r.Left-f.Width;
f.Show;
end;
end.
think otherwise: since the first code worked, and the second code all it does is move the window to the right, and it doesn't work for you, it means that you did something wrong.
this is my test app unit I just made for a doublecheck:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender
var f:tform; taskbar:hwnd; r:trect;
begin
taskbar:=findwindow('Shell
f:=tform.CreateParented(ta
SetWindowLong( f.Handle, // hide captionbar
GWL_STYLE,
GetWindowLong( f.Handle, GWL_STYLE )
and not WS_CAPTION ) ;
f.ClientHeight := f.Height;
GetWindowRect(FindWindowEx
f.Left:=r.Left-f.Width;
f.Show;
end;
end.
think otherwise: since the first code worked, and the second code all it does is move the window to the right, and it doesn't work for you, it means that you did something wrong.
ASKER
you did not see the printscreen that I did take from my pc.
look here and you will see what i am talking about.
http://www.nucleodaweb.com/taskbar2.jpg
look here and you will see what i am talking about.
http://www.nucleodaweb.com/taskbar2.jpg
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
http://www.microsoft.com/msj/1199/bandobj/bandobj.aspx
there's a code in C++ but I really want in delphi, do you mind?
ASKER
take a look on that picture, that's what I want to do!!!
http://www.microsoft.com/msj/1199/bandobj/bandobjfig12.gif
http://www.microsoft.com/msj/1199/bandobj/bandobjfig12.gif
I know that is what you want. that's what I said you need as well :) ("you will have to do a bandobject/daskband. fun starts from here:")
If you want me to do a small demo for you then please give me time till the weekend. I'm a day behind my project (the type I'm getting paid for ;) ) and I must make it up.
If you want me to do a small demo for you then please give me time till the weekend. I'm a day behind my project (the type I'm getting paid for ;) ) and I must make it up.
ASKER
Thank's ciuly. you help me a lot, when you get time, if you can send me a example, i'm going to be so glad.
ok. then just post a reminder message on friday night. just to make sure I don't forget :D
thanks
thanks
hi. you forgot to ping me :P lucky I went through my emails looking for old questions to archive :)
anyway, I looked over the article you posted: way too big for me to translate it. so I did another searching for almost an hour (yes, I was looking for ready made stuff :D) and then I found the following stuff:
- there used to be a component (set?) named zDeskBar or yDeskBar or soemthing like that which is now included in JEDI as jvDeskBand. didn't try it out.
- there is this article: http://delphi-notes.blogspot.com/2005/12/deskbands-with-delphi.html with source on BDN which actually works. it's in german. all you need to know is that the comment with the GUID probably means that you need to change the guid (since ctrl+shift+G generates a new GUID.)
you can star from any of the above 2 possibilities as a skeleton and work on that to include your functionality.
anyway, I looked over the article you posted: way too big for me to translate it. so I did another searching for almost an hour (yes, I was looking for ready made stuff :D) and then I found the following stuff:
- there used to be a component (set?) named zDeskBar or yDeskBar or soemthing like that which is now included in JEDI as jvDeskBand. didn't try it out.
- there is this article: http://delphi-notes.blogspot.com/2005/12/deskbands-with-delphi.html with source on BDN which actually works. it's in german. all you need to know is that the comment with the GUID probably means that you need to change the guid (since ctrl+shift+G generates a new GUID.)
you can star from any of the above 2 possibilities as a skeleton and work on that to include your functionality.
yep, ciuly intuitively translated it right. when i experimented on deskbands it wasnt the purest fun, because basical behaviour worked fine (like showing it) and then minorities rapidly crashed the shell (like moving, resizing it).
one thing was very new to me reading the MSJ article: hiding/closing a deskband will the shell NOT release its memory - restoring/showing the deskband (again) will allocate its own memory for it! so i wonder if the mediaplayer is indirectly also a "mem-eater". i dont use it either, so just try it yourself, always switching between the actual mediaplayer application (its main window) and the deskband while watching your memories in the taskmanager.
anyway, thanks also ciuly for finding out :)
one thing was very new to me reading the MSJ article: hiding/closing a deskband will the shell NOT release its memory - restoring/showing the deskband (again) will allocate its own memory for it! so i wonder if the mediaplayer is indirectly also a "mem-eater". i dont use it either, so just try it yourself, always switching between the actual mediaplayer application (its main window) and the deskband while watching your memories in the taskmanager.
anyway, thanks also ciuly for finding out :)
procedure TForm1.Button1Click(Sender
var f:tform; taskbar:hwnd;
begin
taskbar:=findwindow('Shell
f:=tform.CreateParented(ta
SetWindowLong( f.Handle, // hide captionbar
GWL_STYLE,
GetWindowLong( f.Handle, GWL_STYLE )
and not WS_CAPTION ) ;
f.ClientHeight := f.Height;
f.Show;
end;