Solved

Show a icon on the windows task bar

Posted on 2000-03-01
15
234 Views
Last Modified: 2010-04-04
In my program, I use a timer, it executes procedure every 10 sec, and show me a message(MesssageDlg). I like it shows me a icon on the windows task bar, and if I click on the task bar, it can response my click (means the click can trigger a procedure). How can I do this?

Thank you very much.

Peter Shaw
0
Comment
Question by:petershaw9
15 Comments
 
LVL 2

Expert Comment

by:PeterLarsen
ID: 2575624
This explain how to do it !
                      http://www.borland.com/devsupport/delphi/faq/FAQ2911D.html 

Good luck
PL
0
 
LVL 1

Expert Comment

by:wmckie
ID: 2575743
The reply from Peter Larsen is quite correct, however if you get hold of a copy of the RX component suite (www.rxlib.com) there are a couple of components that will create a systray app, also I think that there are some similar components on the Delphi5 companion disk.

Cheers - Walter McKie
0
 
LVL 1

Expert Comment

by:nrico
ID: 2575972
The point is: Do you mean the Taskbar or the System Tray?

The taskbar is the entire bar at the bottom of your screen, where the windows you have on your screen are displayed, and the system tray is the rectangle at the lower right corner of your screen where the programs that reside in memory (usually) show up.

If you want to use the systemtray, you can download a component here:

http://www.silicmdr.com/Freeware.htm

It's relatively easy to use and it can respond to clicks.

If you want a window on the taskbar, you could for example create a messagebox with no owner:

MessageBox(0,'Hello world!','MBox',MB_OK Or MB_ICONWARNING);
0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 

Author Comment

by:petershaw9
ID: 2576153
Thank all of you very much.
I haven't try the components. But I try the MessageBox(0,'Hello world!','MBox',MB_OK Or MB_ICONWARNING);
It shows a icon on the taskbar, but it shows box on the screen too, that is I don't want.
Nrico said a program can show on the system tray. Can I just show a form or anything that generated by my program shows on the system tray? and if I click on it, It can response to me, so that I can write code. For example if I click on it, a form shows up.

Peter Shaw  
0
 
LVL 2

Accepted Solution

by:
PeterLarsen earned 50 total points
ID: 2576199
It's not a problem to do what you want. Take a look at Delphis faq's and you will find the answer there.
0
 

Author Comment

by:petershaw9
ID: 2594759
I have done the icon on the systray. but I found the popupmenu short cut is not working. I used the applicationevents component's the shortcut event and also add a couple of lines on the WinProc procedure, like if Msg.msg = WM_kEYdOWN then if msg.wparam = ord('o') then open1click(self);
these didn't work. How can I let the popup menu shortcut work?

Thanks

Peter Shaw
0
 
LVL 2

Expert Comment

by:PeterLarsen
ID: 2595071
I will look into it very soon..
0
 
LVL 2

Expert Comment

by:PeterLarsen
ID: 2596926
TPopUpMenu dont have its own WindowHandle, so it's not possible to set focus to the menu.

The menu is inherited from TMenu/Tcomponent, and TComponent dont have a WindowHandle, because it's not a visible control. It do have a handle, but it comes from TApplication.Handle.

So it is not possible to set focus to the menu only, but to its owner.

I will try to find a solution to this problem - and if i find one, i will post a comment here.

Regards
Peter
0
 

Author Comment

by:petershaw9
ID: 2598011
Thank u very much.

Peter Shaw
0
 

Author Comment

by:petershaw9
ID: 2598062
peter
I realise I didn't the explain my question clearly. Maybe it mislead you. So I would like to clarify the question. The problem is the Accelerator keys in the popmenu do not work.

Best regards

Peter Shaw
0
 
LVL 2

Expert Comment

by:PeterLarsen
ID: 2603808
Accelerator keys - is that the same as short-cuts ??
0
 

Author Comment

by:petershaw9
ID: 2609215
Similar. In the manu or popmanu caption,
we write Open as &Open, so that there is an underscore under the 'O'. That is formally called Accelerator key.

petershaw
0
 
LVL 2

Expert Comment

by:PeterLarsen
ID: 2611364
OK,
But it doesn't matter - the problem is still the same.
The menu must have focus before it can receive key events.

Take a look at the following sample :
(The popupmenu is own by form1).

Form1.Show;
PopUpMenu1.PopUp(XPos, YPos);
Form1.SetFocus;

This is what it takes - now the menu is capable of receiving key events, because the owner of the windowhandle is visible.

If this is very important to you, i think you should consider to use a form (TForm) as a popupmenu.

Regards
Peter
0
 

Author Comment

by:petershaw9
ID: 2614775
peter
Thank u very much. I will try this.

Peter Shaw
0
 
LVL 2

Expert Comment

by:PeterLarsen
ID: 2615178
Hi Peter,

You could place a TPopUpMenu on a TForm. Size the form downto e.g. 20x20 pixels and only make it visible when the menu is needed - also remember to hide the border :

PopUpMenu1.PopUp(XPos, YPos);
PopForm.Left:=XPos+10;
PopForm.Top:=YPos+10;
PopForm.Show;
PopForm.SetFocus; //if it is needed.

I think you should rewrite the question into a new question - just to make sure that i have got this WindowHandle stuff right.
Maybe someone else have solved the problem.

Regards
Peter
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…

860 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