Shell_NotifyIcon()

How can I get a 16x16 icon to display on the system tray?

I have a resource icon that has a 32x32 and a 16x16 image in it.  When I NIM_ADD it to the tray, it always squashes the 32x32 image--making it look terrible.
RayRenteriaAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

lif081199Commented:
Delete the 32x32 icon in order the 16x16 one stay alone.

To to this, edit the icon with the VisualStudio editor, select the 32x32 one (with the combo just above the icon), and then use the menu Image, sub menu Delete Device Image.

If you want to keep the 32x32 device too, copy it in another icon resource and delete the 32x32 device as explain above.

Good luck,
Lionel.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
lif081199Commented:
Program solution :
Or use the LoadImage function :

HANDLE LoadImage(
HINSTANCE hinst,   // handle of the image instance
LPCTSTR lpszName,  // name or identifier of the image
UINT uType,        // type of image
int cxDesired,     // desired width
int cyDesired,     // desired height
UINT fuLoad        // load flags
);

HICON Ic;
Ic = (HICON)LoadImage(gInstance,MAKEINTRESOURCE(ICO_MYICON),IMAGE_ICON,16,16,0);
TrayMessage(hDlg, NIM_ADD, IDC_GO, Ic, "MindTwist ChronoTel");

With LoadImage, you can specify the size needed.

Lionel.


0
lif081199Commented:
The second answer is better.

LoadImage will choose the 16x16 device.

Lionel.
0
RayRenteriaAuthor Commented:
JEEZ!  Do you know how long I've been wanting to know how to do this!?!  

Both solutions worked.  They both now seems all too obvious.  Thanks!

--Ray
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.