[DUG] TTrayIcon

Conor Boyd Conor.Boyd at trimble.co.nz
Thu Sep 14 12:42:14 NZST 2006


If you don't want to do it yourself, there are any number of free
components out there that do this sort of thing.
 
You could look at the JVCL library for a start.
 
It's JvTrayIcon component allows you to assign a popup menu etc.
 
Also, I don't think the TTrayIcon in D2006 is expected to remove your
application from the taskbar.
 
I use the following code in my dpr source to accomplish that:
 
  Application.ShowMainForm := False;
  SetWindowLong(Application.handle, GWL_EXSTYLE,
    GetWindowLong(Application.handle, GWL_EXSTYLE) or WS_EX_TOOLWINDOW
and not WS_EX_APPWINDOW);

If you're going to handle the tray icon yourself, you'll have to get to
grips with window messages, callbacks from your icon, etc...
 
HTH,
 
Conor

________________________________

From: delphi-bounces at ns3.123.co.nz [mailto:delphi-bounces at ns3.123.co.nz]
On Behalf Of John Bird
 
I have a program (the Analogue clock widget) that would be useful to
have in the system tray mainly so that it doesn't minimise when a user
hits the Show Desktop shortcut to minimise all windows.  (This is an
icon in the quick launch toolbar on XP)
 
I did some experimentation with TTrayIcon in D2006 and it doesn't work
quite as I expected - it does nicely create an icon in the system tray,
but also still on the task bar, and minimise all programs mentioned
above still minimises it.  Also there is no right click menu supplied
with the tray icon by default- so I presume further coding is still
needed to add this.
 
I could either add further code to do this - any suggestions?
 
-or-
 
I could leave it instead with a normal task bar icon and use the
Tapplication.onminimise event (TapplicationEvents component) to just
maximise it again (add a line saying application.restore).  *However*
this event is fired when I click the minimise icon for the individual
program, but not when minimise all is clicked.....
Any suggestions?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://ns3.123.co.nz/pipermail/delphi/attachments/20060914/721b93b6/attachment.html


More information about the Delphi mailing list