How add a skype-like notification count to a c# program icon - c#

I'm working on a project and we'd like to add a notification count the way skype does.
A number pops near the icon in the windows taskbar to indicate how many messages the user have received.
This is the result we're trying to achieve: http://it.tinypic.com/r/2guclkk/8
Looking around the internet haven't led to anything, so is there any API I can use in C# to achieve this?

I solved using the WindowsAPICodePack: Windows API Code Pack: Where is it?
The method is SetIconOverlay():
public void SetOverlayIcon(IntPtr windowHandle, Icon icon, string accessibilityText);

If you want that in taskbar, you might want to use overlay icons, which are described here, if you are using WPF: How to add dynamic text as Taskbar Icon overlay?
If you are using Forms you might want to use this: https://msdn.microsoft.com/en-us/library/system.windows.shell.taskbariteminfo.overlay%28v=vs.100%29.aspx
If you want to do the same in system tray, it is a duplicit question: How can I overlay system-tray icon ? WPF, and the answer is probably to draw the desired number at runtime to the icon and change the system tray icon.

Related

C# WPF Overlay for fullscreen applications?

I'm making an app that displays what keys you are pressing, and I was wondering if there was a way to overlay some image widgets on top of the screen so that they stay on top even when you are in full screen mode. I'm using WPF with Visual Studio. A link to a tutorial or a download to an example would help a ton!
You haven't clarified whether you want the widgets to appear over top of all windows, or just your WPF one.
If you want it to appear over just your window then look into use an adorner.
If you want it to appear over all windows then use this WindowSinker class which intercepts the WM_SETFOCUS message for your window and calls SetWindowPos to set the HWND_TOPMOST flag.

C# Desktop App Bar (Somewhat Like a taskbar)

I've been googling a lot for this one and I can't seem to find anything. Maybe it's the way that I'm wording it. So basically what I'm looking to do in C# using Windows Forms, is create a form and have it essentially take the shape of the taskbar and do the same functions as the taskbar, but it will sit above the task bar or at the top of the screen.
It can't be "ON TOP" (I'm not trying to block user buttons like the close button of a program they are using).
Autohide would be a plus.
This is the main thing I'm after:
It needs to act just like the task bar. When you maximize any other window, the taskbar does not go over the top of the window, even though it is set to "on top".
You'll want to use an Appbar to do this:
http://msdn.microsoft.com/en-us/library/cc144177.aspx
For more information, check out here and here and here.
If you don't want to deal with C++ and Native Code (as #FKunecke correctly proposed) then you'll not find anything predefined for this. What you can do is create a form for your bar and make the visualization calculations by hand, then you can set the screen location of it. That's all. Not forcing the bar form to stay on top will not hide the other app forms so you'll get that for free.
Now, to fully implement what you want there are some problems you need to deal with, such as Taskbar location and height. Then you'll need to use some native code tricks.

Changing taskbar button color on Windows

Multiple instances of the same application are running at the same time, and since each has multiple windows, it is not easy for the user to navigate between them. I help users by setting the titlebar color of different application instances to a different value. For example, all windows of the app instance started first will have red titlebar, all windows of the second instance will have a green one, etc.
It would also be useful to set the taskbar button color of app instances to the color I use for the titlebar. Is this possible? If not then I would be happy with a solution having similar differentiating effect, like setting the color of the text on the taskbar button, adding an overlay icon to it, etc.
The solution should work on Windows XP and later Windows versions. The language can be C/C++, C# or Delphi. Thank you very much in advance!
You cannot hope to achieve differently coloured taskbar buttons.
You could install your own shell and take complete control of the taskbar, but you can't expect your clients to do that.
You cannot expect to paint over the top of the Windows taskbar. The taskbar is animated. How are you going to keep up with that? How are you going to even know where the buttons are? I don't believe that there is a public API that will tell you that. I think you have to rule that idea out.
There is an API that allows you to change the colour of a taskbar button. It's the taskbar progress API added in Windows 7. You could use that to make your taskbar buttons yellow, green or red. I personally would not recommend that since the user will think you are showing progress.
The main options that are available to you are to change the window caption, and so the text that appears in the taskbar button. Or to change the icon.

showing the autohiding windows taskbar

I have defined the windows taskbar as auto-hiding. Now I am showing for a way to show the taskbar from C#-code. Can somebody help me perhaps with a little code-snipped?
The taskbar in an AppBar. Which can be controlled using the SHAppBarMessage API.
Here is a separate article on AppBar's which can help you better understand how to use the API:
http://www.codeproject.com/Articles/3728/C-does-Shell-Part-3
Edit:
If you need to find the handle for the Taskbar itself, you can use the FindWindow method. The taskbar is named "Shell_traywnd"

how to get the tray icons

I am making my own taskbar which will replace the default windows one. How do I get a list of everything that is in the system tray (notification area)?
FindWindow with the classname Shell_TrayWnd can get you this information. Here are two sample C++ projects
http://skyscraper.fortunecity.com/gigo/311/winprog/shellico.txt
http://www.codeproject.com/KB/applications/ShellTrayInfo.aspx
If you are trying to create an icon in the notification area (usually near the clock in the taskbar), see the NotifyIcon class. The docs have an example for creating a notification icon with a context menu.

Categories

Resources