Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Application's taskbar popup menu items

3 views
Skip to first unread message

Ray

unread,
Aug 23, 2005, 4:23:50 PM8/23/05
to
Hi,

I can usually tell if a certain application has been written in Delphi by
right clicking the Windows taskbar button of my application (main form).
When you do this with a Delphi application, unlike most Win32 apps, the
only popup menu items that appear are 'Close', 'Minimize', and 'Restore'.
I was wondering how to make it so that when I right click my Delphi app's
Windows taskbar button, it will show the other popup menu items that most
Win32 apps show when you right click their icon in the taskbar (i.e.
'Maximize', 'Size', and 'Move')?

Thanks

Jens Gruschel

unread,
Aug 23, 2005, 4:47:02 PM8/23/05
to

The taskbar button you see isn't the one of your form, but the one of
the application, a hidden window, which doesn't have these options.

I guess there are two solutions:

The first one (never tried): extend the applications system menu. You
can use GetSystemMenu (passing the application's handle, and use the
handle you get for AppendMenu. Then you have to catch WM_SYSCOMMAND
messages posted to your application and trigger the proper action (maybe
by simulating a click to the form's system menu).

The other (and probably better) solution is to hide the applications
taskbar button and show the form's button instead. You might run into
other problems, but basically you need following things:

procedure TForm1.CreateParams(var Params: TCreateParams); // override
begin
inherited;
// make taskbar button visible for this form:
Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
// remove application taskbar button:
ShowWindow(Application.Handle, SW_HIDE);
SetWindowLong(Application.Handle, GWL_EXSTYLE,
GetWindowLong(Application.Handle, GWL_EXSTYLE) or WS_EX_TOOLWINDOW);
end;

I hope I didn't forget something...

Jens

--
Jens Gruschel
http://www.pegtop.net

Peter Below (TeamB)

unread,
Aug 24, 2005, 5:39:31 AM8/24/05
to

making the taskbar button show the main forms system menu
TStandardSystemMenu component on Colin Wilsons website
http://www.wilsonc.demon.co.uk/delphi.htm


--
Peter Below (TeamB)
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be


0 new messages