The one I have used which I am happy with is mdTrayIcon by Martin Djaernes.

You can make an application autohide to the system tray (like the Volume
Control popup adjustment) with the following code by firing the
Application.On Deactivate event, telling it to hide the main form. I suppose
setting the form to minimise first would produce the animated effect that
ZoneAlarm and other tray apps sometimes produce.

If you have a close button on the title bar and want to minimise to the
system tray when they click the close button (like ZoneAlarm does), use this
as an example:

1. Add a property to the form called PermitClose.
2. Set this to false in FormCreate
3. In the FormCloseQuery event handler, put this code:

   MainForm.Hide;
   CanClose := PermitClose;

4. In the private declarations of your form, put this procedure declaration

    procedure EndSession(var Message : TMessage); message
WM_QUERYENDSESSION;

5. Here is the code of this procedure:

procedure TMainForm.EndSession(var Message : TMessage) ;
begin
   PermitClose := true;
   Message.Result := Integer(True);
end;

How does this work? The CloseQuery event procedure is called every time the
user tries to close the form. The default behaviour is to tell Delphi that
the application can't be closed, so the form appears to disappear to the
system tray.

The EndSession procedure is a message handler for the WM_QUERYENDSESSION
operating system message. Windows sends this message to each running
application whenever the user attempts to shut down, log off or restart
their computer. The message essentially asks the application whether it can
exit or not. It does not shut down the application at this point. If the
application returns false then Windows will not be shut down. Returning true
indicates the application can be exited.
The actual attempt to close the application will occur when the message
WM_ENDSESSION is sent by Windows, which occurs if all applications return
true.

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Ross Levis
> Sent: Wednesday, 5 September 2001 16:45
> To: Multiple recipients of list delphi
> Subject: RE: [DUG]: System Tray app
>
>
> Well I downloaded & installed RXLIB and setup a basic tray app.
> The EXE is
> 299k - 12k larger than an empty form.  Doesn't seem too bad.  I'll keep an
> eye on that if I use other controls.
>
> Thanks for the info, however.
>
> Cheers,
> Ross.
>
>
> [EMAIL PROTECTED] wrote:
> > You already have source on your pc that puts an icon into the
> > tray area.
> > Look at the source for the socket server (it's in the source\vcl
> > directory).  Watch out using RXLib.  Last time I used it, it added
> > tremendous bloat to the application because everything is so closely
> > coupled.  That may have changed now though.
> >
> > JED
> >
> > >I only want it to appear in the System Tray with a few
> > right-click options
> > like Enable/Disable, Exit etc.
> >
> >
> >
> > **********************************************************************
> > This email and any files transmitted with it are confidential and
> > intended solely for the use of the individual or entity to whom they
> > are addressed. If you have received this email in error please notify
> > the [EMAIL PROTECTED]
> >
> > **********************************************************************
> > --------------------------------------------------------------
> > -------------
> >     New Zealand Delphi Users group - Delphi List -
> > [EMAIL PROTECTED]
> >                   Website: http://www.delphi.org.nz
> > To UnSub, send email to: [EMAIL PROTECTED]
> > with body of "unsubscribe delphi"
> > Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
> >
> ------------------------------------------------------------------
> ---------
>     New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz
> To UnSub, send email to: [EMAIL PROTECTED]
> with body of "unsubscribe delphi"
> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/
>

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED] 
with body of "unsubscribe delphi"
Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/

Reply via email to