I've come across a slight problem that I'm not sure how to fix.
First I'll let you know that this is mainly because of one of my applications that has a notify icon, and it's connected to my iTunes, and when ever iTunes changes songs, my application gets notified, and then shows a balloon tip about the current song playing in iTunes.
The problem is, if I step away from my computer, and another notify icon other than mine has a balloon tip, mine won't appear until my computer gets some sort of user input.
This is fine... Unless I leave iTunes running for who knows how long.
Let's say a balloon tip appears that isn't mine, and my application gets notified that iTunes has changed songs 100 times by the time that my computer gets user input again, this causes the balloon tip that isn't mine to disappear, and then mine to appear... But the first one, and then that one will disappear, and then it'll show the second one, and then disappear as well, and this keeps going until it reaches the current balloon tip that it should be showing, or the song changes again.
Now I'm assuming the problem lies in how windows handles balloon tips, because awhile ago I read something about balloon tips and how they work, and from what I remember, this is something to do with that.
Anyway, if someone could suggest a way or tell me how to prevent multiple delayed balloon tips, that would be great...
And if I'm out of luck, please let me know as well.
1 4483
Well I think I've found a temporary solution to my problem. -
public partial class Form1 : System.Windows.Forms.Form
-
{
-
public System.Windows.Forms.NotifyIcon MyIcon { get; set; }
-
public System.Windows.Forms.NotifyIcon OtherIcon { get; set; }
-
public bool BalloonWaiting { get; set; }
-
-
public bool UseDefaultMethod { get; set; }
-
-
public Form1()
-
{
-
InitializeComponent();
-
-
this.UseDefaultMethod = true;
-
-
this.OtherIcon = new System.Windows.Forms.NotifyIcon();
-
this.OtherIcon.Icon = this.Icon;
-
this.OtherIcon.Visible = true;
-
-
this.MyIcon = new System.Windows.Forms.NotifyIcon();
-
this.MyIcon.Icon = this.Icon;
-
this.MyIcon.BalloonTipShown += new System.EventHandler(NotifyIcon_BalloonTipShown);
-
this.MyIcon.Visible = true;
-
}
-
-
public void NotifyIcon_BalloonTipShown(object sender, System.EventArgs e)
-
{
-
this.BalloonWaiting = false;
-
}
-
-
public void ShowBalloon(int Timeout, string Title, string Text, System.Windows.Forms.ToolTipIcon Icon)
-
{
-
if (string.IsNullOrEmpty(Title)) Title = " ";
-
if (string.IsNullOrEmpty(Text)) Text = " ";
-
-
this.MyIcon.BalloonTipTitle = Title;
-
this.MyIcon.BalloonTipText = Text;
-
this.MyIcon.BalloonTipIcon = Icon;
-
-
if (this.MyIcon.Visible)
-
{
-
System.Console.WriteLine(this.BalloonWaiting);
-
if (!this.BalloonWaiting)
-
{
-
this.BalloonWaiting = true;
-
this.MyIcon.ShowBalloonTip(Timeout);
-
}
-
else
-
{
-
this.MyIcon.Visible = false;
-
this.MyIcon.Visible = true;
-
-
this.MyIcon.ShowBalloonTip(3000);
-
}
-
}
-
}
-
-
private void Form1_Click(object sender, System.EventArgs e)
-
{
-
this.OtherIcon.ShowBalloonTip(10000, "Blocking Application", "I'm blocking you.", System.Windows.Forms.ToolTipIcon.Info);
-
-
if (this.UseDefaultMethod)
-
{
-
this.MyIcon.ShowBalloonTip(3000, "Bob", "Says hello.", System.Windows.Forms.ToolTipIcon.Info);
-
System.Threading.Thread.Sleep(3000);
-
this.MyIcon.ShowBalloonTip(3000, "Bob", "Says hello again.", System.Windows.Forms.ToolTipIcon.Info);
-
System.Threading.Thread.Sleep(3000);
-
this.MyIcon.ShowBalloonTip(3000, "Bob", "Says hello once again.", System.Windows.Forms.ToolTipIcon.Info);
-
System.Threading.Thread.Sleep(3000);
-
this.MyIcon.ShowBalloonTip(3000, "Why", "Is bob saying hello so much.", System.Windows.Forms.ToolTipIcon.Info);
-
}
-
else
-
{
-
this.ShowBalloon(3000, "Bob", "Says hello.", System.Windows.Forms.ToolTipIcon.Info);
-
System.Threading.Thread.Sleep(3000);
-
this.ShowBalloon(3000, "Bob", "Says hello again.", System.Windows.Forms.ToolTipIcon.Info);
-
System.Threading.Thread.Sleep(3000);
-
this.ShowBalloon(3000, "Bob", "Says hello once again.", System.Windows.Forms.ToolTipIcon.Info);
-
System.Threading.Thread.Sleep(3000);
-
this.ShowBalloon(3000, "Why", "Is bob saying hello so much.", System.Windows.Forms.ToolTipIcon.Info);
-
}
-
}
-
The only problem with this is that there is a flicker in the system tray every so often when the icon visibility is toggled.
Any improvements are welcome, and any better solutions are really welcome.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Job Lot |
last post by:
How can I prevent multiple instances of MdiChild form? I have a MdiParent
form with a DataGrid showing all the clients in the database. User clicks on
a row to open MdiChild form which display...
|
by: logicalfeline |
last post by:
How do you prevent multiple instances of a program from running?
Cat
|
by: Brian Keating EI9FXB |
last post by:
Hello there,
What is the best way in c# to prevent multiple instances of my application
running at same time on one machine?
thanks
Brian
|
by: anoj |
last post by:
Hi All
i need to prevent multiple logins from the same user at the same time.
what is the best way to do this .
How can i detect if a user closes the browser window without logging
out so tht...
|
by: Gleep |
last post by:
I've searched google intensely on this topic and it seems noone really knows how to approch this.
The goal I don't want clients to give out their usernames and passwords to friends, since the site...
| |
by: lushgrass |
last post by:
this is a .net 2003 c# windows form project.
there is a menu button called "search"
it does a lot of stuff and takes some time. i need to prevent the form from allowing the user to click on it...
|
by: Aliriazi |
last post by:
All,
I have created a simple database, which includes a receiving table and outgoing table in my receiving table I have a multiple entry of the same fields. I am trying to create a query that...
|
by: Bhavini |
last post by:
Hi All,
I have to prevent multiple logins for the same user accessing at same time.
i.e. if xyz user is active, no other login should be allowed for the same
user ID.
I thought of saving...
|
by: Job Lot |
last post by:
How can I prevent multiple instances of a C# windows forms application.
VB.NET provides My.Application.StartupNextInstance Event to do this. Is there
any C# equivalent as well?
Thanks
|
by: visweswaran2830 |
last post by:
Hi,
I want to prevent multiple user login for same user in asp.net.. How can I achieve. Note: I want to control without database concepts
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
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: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |