?
Solved

Show a icon on the windows task bar

Posted on 2000-03-01
15
Medium Priority
?
244 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
[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
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
Independent Software Vendors: 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!

 

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

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.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses
Course of the Month13 days, 17 hours left to enroll

800 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