Solved

Show a icon on the windows task bar

Posted on 2000-03-01
15
224 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
I will look into it very soon..
0
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
LVL 2

Expert Comment

by:PeterLarsen
Comment Utility
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
Comment Utility
Thank u very much.

Peter Shaw
0
 

Author Comment

by:petershaw9
Comment Utility
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
Comment Utility
Accelerator keys - is that the same as short-cuts ??
0
 

Author Comment

by:petershaw9
Comment Utility
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
Comment Utility
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
Comment Utility
peter
Thank u very much. I will try this.

Peter Shaw
0
 
LVL 2

Expert Comment

by:PeterLarsen
Comment Utility
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

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

Suggested Solutions

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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 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

13 Experts available now in Live!

Get 1:1 Help Now