473,386 Members | 2,078 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Howto use NotifyIcon single click to bring form in front?

Hello,

I have an application with a notifyIcon. When my application's main form is
hidden by some other window I would like to bring it in front by
single-clicking the NotifyIcon. However, I can't get it done. In the Click
event I've used all sorts of methods:

this.SetTopLevel(true);
this.Show();
this.Focus();
this.BringToFront();

When I try it with my application's form focused, I see that it just loses
its focus! I guess that's because the click on the NotifyIcon shifts focus
to that NotifyIcon. But how can I bring my app's form to front, give it
focus again?

Thanks!
Nov 20 '06 #1
1 7260
Marcel Brekelmans wrote:
I have an application with a notifyIcon. When my application's main form
is hidden by some other window I would like to bring it in front by
single-clicking the NotifyIcon. However, I can't get it done. In the Click
event I've used all sorts of methods:

this.SetTopLevel(true);
this.Show();
this.Focus();
this.BringToFront();

When I try it with my application's form focused, I see that it just loses
its focus! I guess that's because the click on the NotifyIcon shifts focus
to that NotifyIcon. But how can I bring my app's form to front, give it
focus again?
this.Activate() is what you are looking for.
--
Tom Porterfield

Nov 20 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: John | last post by:
I use NotifyIcon to minimize my app to the system tray. I also check everytime my app runs for the previous instance, if it is running, call SetForegroundWindow to bring its window up front and...
0
by: petterl | last post by:
I have tried to find the error in the code below but I always get " An unhandled exception of type 'System.NullReferenceException' occurred in Unknown Module. Additional information: Object...
2
by: Rob Mayo | last post by:
OK, maybe this is my opinion, maybe these are bugs. Given the folowing: I have a NotifyIcon on my Form, a Context menu associated with the NotifyIcon, and a MenuItem on the ContextMenu set as...
3
by: Glen | last post by:
Can anyone tell me if there is a workable method to get the mouse cursor position on the screen or the NotifyIcon position? I need to display a context menu for the NotifyIcon when clicked and I'd...
12
by: mdb | last post by:
My app has a notify icon in the systray. I want the left mouse click to initiate a menu, and a right-mouse click to do something else. Normally, for a button, I would listen to MouseDown and if I...
0
by: nospam | last post by:
I have an application that is made up of a single module for my global variables and then multiple classes. There is no form. I am using a notifyicon as my notification(Basically different...
0
by: =?Utf-8?B?anAybXNmdA==?= | last post by:
I have a ContextMenuStrip that I added to my NotifyIcon. Whenever the Main Form has been hidden, the NotifyIcon can be right-clicked, and the Operators can select "Show Form." The...
1
by: \Ji Zhou [MSFT]\ | last post by:
Hello Jason, Thanks for using Microsoft Newsgroup Support Service, my name is Ji Zhou and I will be working on this issue with you. I have tried to but cannot reproduce your issue on my side....
8
by: starrysky | last post by:
I have a program which puts an icon in the notification area and has a menu associated with it available by right clicking on the icon. I want the menu items to be selected by single left clicks but...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.