Saturday, August 7, 2010

Display Overlay Icons in the Taskbar

Following the trend of the previous posts, we stay with nice functions of the Windows API Code Pack. A further new function is the possibility of showing so called Overlay Icons in the taskbar. They are blended over the actual program icon and thus can also display status information, as for example the red cross in the example:

As mentioned, to be able to do so, the Code Pack needs to be included, as is for example described here.
Then the following code induces the showing of an overlay icon:

TaskbarManager tm = TaskbarManager.Instance;
Icon OverlayIcon = new Icon("error.ico");
tm.SetOverlayIcon(OverlayIcon, "Fehler");
The function SetOverlayIcon() determines the icon to be shown, as a first parameter we can use an arbitrary icon, as second a text, which will be displayed alternatively, if the icon is not available.
The following code hides the overlay icon again:


No comments:

Post a Comment