Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
I want to make taskbar notification as like yahoo messenger or other messenger. When new message comes, small notification will appear on the taskbar.How I can make small taskbar notification in web application using asp.net ?
Posted 15-Oct-12 20:15pm
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

To start off create a C# Windows Forms Application project and on your main form drag the NotifyIcon component from the toolbox to the form. From the component’s properties you can set the icon to be displayed in the system tray, the text to be displayed when the mouse hovers over the tray icon, balloon tip settings, and other common properties that most of the .NET components have.
 

Now for this example add a button to your form and add the following code to its click event handler:
 
this.WindowState = FormWindowState.Minimized;
 
notifyIcon.BalloonTipIcon = ToolTipIcon.Info;
notifyIcon.BalloonTipTitle = "Notify Icon Test Application";
notifyIcon.BalloonTipText = "You have just minimized the application." +
Environment.NewLine +
"Right-click on the icon for more options.";
 
notifyIcon.ShowBalloonTip(5000);
The above code is minimizing the form and then setting the balloon tip properties for the NotifyIcon we added earlier. Finally we are calling the ShowBalloonTip method which as a parameter accepts the number of milliseconds you want to display the balloon for – in this case 5 seconds.
 
Now at this point you should be able to see something like this (the icon will vary according to what you selected from the NotifyIcon‘s properties):
 

 
At the moment when you right-click on the tray icon nothing happens. This is because we have to add a ContextMenuStrip component to our form and assign it to the NotifyIcon. Add the control to your form and from the ContextMenuStrip property of the NotifyIcon select the name of your context menu.
 
And there you have it – the menu will pop up when you right click the tray icon. But the context menu is still empty so first you must add a few items to it. Add a menu item to restore the application and another to exit. Then your code should be something like this:
 
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
 
private void restoreToolStripMenuItem_Click(object sender, EventArgs e)
{
this.WindowState = FormWindowState.Normal;
}
As you can see the NotifyIcon is a very simple component to use. You can fully control its behaviour through code so you can display warning bubbles or error bubbles to the user very easily, plus you can attach whatever functionality you like to the context menu which can make your application easier to use.
  Permalink  
Comments
SoMad at 8-Mar-13 3:15am
   
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

In web application it is some what difficult task. because you rarely see a web application manipulating a windows task.
 
If you note, the notifications coming from gtalk and yahoo messenger are coming because you have installed an application for that.
 
That G-talk or Yahoo messenger software act a bridge between the web server and your windows. Normally in a web application there is web server and browser so results are returned to your browser only not to the windows.
 
To accomplish what you want to do, you have to create a simple exe file ie. a windows application which runs in background or something and let that application communicate with your web server and then process and give a pop up notification.
 
NOTE : If this thing was so easy then you would have seen facebook notifications poping up through your task bar. Smile | :)
 
Enjoy Coding. Smile | :)
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 393
1 Sergey Alexandrovich Kryukov 232
2 Richard Deeming 180
3 Snehasish_Nandy 171
4 ChauhanAjay 170
0 Sergey Alexandrovich Kryukov 6,367
1 OriginalGriff 5,588
2 CPallini 2,473
3 Richard MacCutchan 1,627
4 Abhinav S 1,530


Advertise | Privacy | Mobile
Web04 | 2.8.140821.2 | Last Updated 16 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100