[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 443
  • Last Modified:

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.
0
RayRenteria
Asked:
RayRenteria
  • 3
1 Solution
 
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
 
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

Featured Post

Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now