Control Panel Applet meets dynamic icons
Hi!
I've been trying to create a control panel applet which will provide
dynamic items based on some externally configurable data. However, I
cannot manage to get it working because icons won't display properly.
I handle CPL_INQUIRE like this:
lpCplInfo->lData = 0;
lpCplInfo->idIcon = CPL_DYNAMIC_RES;
lpCplInfo->idName = CPL_DYNAMIC_RES;
lpCplInfo->idInfo = CPL_DYNAMIC_RES;
and in the CPL_NEWINQUIRE handler I use LoadImage() function to load
the icon, like this:
HICON icon = (HICON) ::LoadImage(NULL,
iconPath,
IMAGE_ICON,
0, 0,
LR_LOADFROMFILE | LR_DEFAULTSIZE);
lpNewCplInfo->hIcon = icon;
The icon loaded correctly, but never displayed (i.e. the result is the
same as putting NULL into hIcon field).
Some more points:
1. The szName and szInfo fields of NEWCPLINFO structure I set are in
effect and Control Panel actually displays them.
2. I've tried to add LR_DEFAULTCOLOR to the flags in call to
LoadImage, but it didn't make any difference.
3. When I using resource id of some icon built in into my .cpl file in
place of CPL_DYNAMIC_RES I get that test icon displayed properly.
What could be the problem?
--
Alex Shulgin