?
Solved

Tray Icon Applet - how do you do it?

Posted on 1998-12-30
9
Medium Priority
?
193 Views
Last Modified: 2010-04-04
Help! I would like an applet I have written to appear in the System Tray instead of minimising. Does anyone know how I can do this in Delphi 4.0? Am I missing something obvious like Form.MinimizeMode:=mmSystemTrayIcon, or does it need one of those mumbo-jumbo H_WIND_BOLLOX API call thingies? :-) Seriously, if it is, please try to be more helpful than the Win32 API Help File?
0
Comment
Question by:PaulCutcliffe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 

Author Comment

by:PaulCutcliffe
ID: 1353891
Edited text of question
0
 
LVL 5

Expert Comment

by:JimBob091197
ID: 1353892
Hi

You need to use the "Shell_NotifyIcon" API (declared in ShellAPI.pas) to add/remove tray icons.

There are many components that do this for you - just drop on a form, assign an icon & popup menu, and *Bingo*
I recommend you look on the Delphi Super Page (http://sunsite.icm.edu.pl/delphi/) - search for "Tray".  There are quite a few...

Cheers,
JB
0
 
LVL 17

Expert Comment

by:inthe
ID: 1353893
or here is solution without component

http://www.inquiry.com/techtips/delphi_pro/files/10min0798.htm

Regards Barry
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 17

Expert Comment

by:inthe
ID: 1353894
the use of the term 'Bollox' this means your from england right :-)

Regards Barry
(in the midlands)
0
 
LVL 8

Expert Comment

by:ZifNab
ID: 1353895
Hi PaulCutcliffe, I give my two pennies :

you can read all about in this article :

http://www.delumpa.com/tips/apps/apps3.htm 

Or you can use the TrayIcon component of freeware RxLib library. Which I find very handy, because it sticks with a great free library : rx.demo.ru

Or you can use other components... lot's already on the net.
(like JimBob says)

Regards, Zif.
0
 
LVL 4

Expert Comment

by:BoRiS
ID: 1353896
PaulCutCliffe

JimBob and Zifnab are correct there a lot of components out there but here is some code to show you how it is done, I use it on the form create meathod but you can use it any where in the code...

Hi JimBob how things that side, long time no hear....

 public
    { Public declarations }
  procedure IconCallBackMessage( var Mess : TMessage ); message WM_USER
  + 100;
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
var
   Icd : TNotifyIconData;
begin
     ShowWindow(Application.handle, SW_HIDE);
     Self.Hide;
     with Icd do
     begin
           cbSize := SizeOf( TNotifyIconData );
           Wnd := Form1.Handle;
           uID := 1;
           uFlags := NIF_ICON or NIF_MESSAGE or NIF_TIP;
           uCallbackMessage := WM_USER + 100;
           hIcon := Application.Icon.Handle;
           szTip := 'Cool I got it right Wooooo Weeeee';
     end;
     Shell_NotifyIcon( NIM_ADD, @Icd );
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
var
   Icd : TNotifyIconData;
begin
     with Icd do
     begin
           cbSize := SizeOf( TNotifyIconData );
           Wnd := Form1.Handle;
           uID := 1;
           uFlags := NIF_ICON or NIF_MESSAGE or NIF_TIP;
           uCallbackMessage := WM_USER + 100;
           hIcon := Application.Icon.Handle;
           szTip := 'Cool I got it right Wooooo Weeeee';
// All the above is probably not needed.
     end;
     Shell_NotifyIcon( NIM_DELETE, @Icd );
end;

procedure TForm1.IconCallBackMessage( var Mess : TMessage );
var
   sEventLog : String;
begin
     case Mess.lParam of
// Do whatever you wish here. For example popup up a menu on a right click.
          WM_LBUTTONDBLCLK  : sEventLog := 'Left Double Click';
          WM_LBUTTONDOWN    : sEventLog := 'Left Down';
          WM_LBUTTONUP      : sEventLog := 'Left Up';
          WM_MBUTTONDBLCLK  : sEventLog := 'M Dbl';
          WM_MBUTTONDOWN    : sEventLog := 'M D';
          WM_MBUTTONUP      : sEventLog := 'M U';
          WM_MOUSEMOVE      : sEventLog :=  'movement';
          WM_MOUSEWHEEL     : sEventLog := 'Wheel';
          WM_RBUTTONDBLCLK  : sEventLog := 'r dbl';
          WM_RBUTTONDOWN    : sEventLog := 'r down';
          WM_RBUTTONUP      : sEventLog := 'r up';
     end;
end;

end.

Hope this helps

Later
BoRiS
0
 

Accepted Solution

by:
mjustin earned 400 total points
ID: 1353897
Hi,

a component which does this is available free and with source code in the famous RXLib library at http://rx.demo.ru. It even supports animated try icons.

Michael Justin
http://www55.pair.com/betasoft
0
 
LVL 20

Expert Comment

by:Madshi
ID: 1353898
Hi Michael,

you should really read the comments before answering questions.
If you look at Zif's comment from "Friday, January 01 1999 - 05:27AM", you'll see that your info brings nothing new...

Regards, Madshi.
0
 
LVL 17

Expert Comment

by:inthe
ID: 1353899
someone else not read madshi's comment either eh?
perhaps someday they will need help and find there's no one willing
  2¢

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question