Re: [DUG]: System Tray app

2001-09-05 Thread Ross Levis

Thanks Patrick.  I wasn't going to have a visible form at all but it 
turns out I do need one and your example was very useful.

Cheers,
Ross.

Patrick Dunford wrote:

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.



---
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/



RE: [DUG]: System Tray app

2001-09-04 Thread Nahum Wild

Performing a search on a couple of Delphi component sites should reveal some
good, free including source, system tray components.

http://www.delphipages.com
http://www.torry.net


Nahum.

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
 Behalf Of Ross Levis
 Sent: Wednesday, 5 September 2001 13:43
 To: Multiple recipients of list delphi
 Subject: [DUG]: System Tray app


 Hi all

 My next project is to write a scheduler utility which will
 contain timer
 events but will not require a visible form for user
 interaction as it will
 be reading all the options setup in another program.  I only
 want it to
 appear in the System Tray with a few right-click options like
 Enable/Disable, Exit etc.

 I've never written anything like this before.  I presume some
 WinAPI calls
 are necessary which I also have never done before.
 Any helpful hints appreciated.

 Cheers,
 Ross.
 --
 -
 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/



re: [DUG]: System Tray app

2001-09-04 Thread Ben Taylor

hi! the easy drag/drop way:

- get rxlib, drop the trayicon component onto the main form
- set the icon etc if you want
- setup a popupmenu with items for 'exit' etc. 
  (exit.onclick should just need form.close)
- edit project source(menu is project/view source'). 
  before the form create stuff add the line:
  Application.ShowMainForm := False;
- may also need to have form.visible:=false too...

see if that works :-)

 I only want it to appear in the System Tray with a few 
 right-click options like Enable/Disable, Exit etc.




---
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/



RE: [DUG]: System Tray app

2001-09-04 Thread Ross Levis

Sounds good Ben, thanks.

Ross.

Ben Taylor wrote:
 hi! the easy drag/drop way:
 
 - get rxlib, drop the trayicon component onto the main form
 - set the icon etc if you want
 - setup a popupmenu with items for 'exit' etc. 
   (exit.onclick should just need form.close)
 - edit project source(menu is project/view source'). 
   before the form create stuff add the line:
   Application.ShowMainForm := False;
 - may also need to have form.visible:=false too...
 
 see if that works :-)
 
  I only want it to appear in the System Tray with a few 
  right-click options like Enable/Disable, Exit etc.
 
 
 
 
 --
 -
 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/



re: [DUG]: System Tray app

2001-09-04 Thread NIRAV KAKU

or you could do it the good old WinAPI way and write the code
which is not any effort at all. Read more on NOTIFYICONDATA.

regards,
NIRAV KAKU


On 4 Sep 01, at 18:54, Ben Taylor wrote:

 hi! the easy drag/drop way:

 - get rxlib, drop the trayicon component onto the main form
 - set the icon etc if you want
 - setup a popupmenu with items for 'exit' etc.
   (exit.onclick should just need form.close)
 - edit project source(menu is project/view source').
   before the form create stuff add the line:
   Application.ShowMainForm := False;
 - may also need to have form.visible:=false too...

 see if that works :-)

  I only want it to appear in the System Tray with a few
  right-click options like Enable/Disable, Exit etc.




 ---
 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/




- From the Shreemat Bhägwat Gïta -
'Sarcasm is the lowest form of wit.'
---
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/



Re: [DUG]: System Tray app

2001-09-04 Thread jnorth


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/



RE: [DUG]: System Tray app

2001-09-04 Thread Ross Levis

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/



RE: [DUG]: System Tray app

2001-09-04 Thread Patrick Dunford

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/