I have both dark and light versions of my application icon; the dark version works best on gray surfaces such as Windows XP taskbar, where the light version works best as an icon in the titlebar.
Is there a way I can set the icon in the taskbar to a different icon than the one used in my form in C# (P/Invoke is fine)?
Send the WM_SETICON message to your form with different icon handles for the ICON_SMALL and the ICON_BIG parameter:
I know this is an old question but I came across it when trying to achieve the same thing, and well yes you can do this, on Windows 7/8 at least.
It turns out an ICO file doesn't just contain one image, it contains 9 different images at 9 different resolutions:
On Windows 7 and 8, the 64x64 image is used on the taskbar, and the 16x16 image is used on the icon which is placed on the top left hand corner of your form.
You can use a tool like Greenfish Icon Editor Pro (I don't work for them or anything, this isn't a plug!) to have these as two seperate images, and then add this
*.ico
file as normal to your Windows Form/WPF form in Visual Studio.The end result is shown below:
As you can see my WPF application has two seperate icons, one in the taskbar and another on the form.