Solved

Show a icon on the windows task bar

Posted on 2000-03-01
15
228 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi with SQL Natvie Client 15 86
Mydac connection data base issue 3 139
oracle global variables 4 63
Multi-layered image in FireMonkey 9 15
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

911 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now