problem with hIconSm ??
Hi, here is my current start up code:
WNDCLASSEX wc;
// Create and register our window class
wc.cbSize = sizeof (WNDCLASSEX);
wc.style = CS_HREDRAW | CS_VREDRAW;
wc.lpfnWndProc = WindowProc;
wc.cbClsExtra = 0;
wc.cbWndExtra = 0;
wc.hInstance = hInstance;
wc.hIcon = LoadIcon (hInstance, MAKEINTRESOURCE (IDI_ICON1) );
wc.hIconSm = LoadIcon (hInstance, MAKEINTRESOURCE (IDI_ICON1) );
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
wc.hbrBackground = (HBRUSH )GetStockObject(BLACK_BRUSH);
wc.lpszMenuName = GAME_NAME;
wc.lpszClassName = GAME_NAME;
RegisterClassEx (&wc);
hWnd = CreateWindowEx(WS_EX_TOPMOST,
GAME_NAME, GAME_TITLE,
WS_POPUP,
0, 0,
GetSystemMetrics(SM_CXSCREEN),
GetSystemMetrics(SM_CYSCREEN),
NULL, NULL, hInstance, NULL);
Now everything is working fine. My app is doing exactly what it should be doing. It is virtually finished, just attempting to get some little aesthetic things done now.
My problem, I have a fancy icon which is displayed for my .exe. But when I ctrl-esc my app to the taskbar, I don''t see my small icon.
My small icon (16x16 16777216 colors) is in the same file as my large icon (32x32 16777216 colors). And as far as I can see, when I minimize my window to the taskbar, then there should be my little icon to the left of my app''s name. But instead I just get my apps name on the taskbar button.
My app uses DirectDraw, in a popup window (so there is no titlebar, etc). Is this perhaps the problem, does anyone think? I haven''t really messed around with small icons before, so this is new to me.
Anyway, thanks for your help. I am planning on having my app sendable to the systemtray (is sendable a word? ) so would like to get my small icon working ready for that.
From MSDN:
"LoadIcon can only load an icon whose size conforms to the SM_CXICON and SM_CYICON system metric values. Use the LoadImage function to load icons of other sizes."
"LoadIcon can only load an icon whose size conforms to the SM_CXICON and SM_CYICON system metric values. Use the LoadImage function to load icons of other sizes."
Solo, thank you very much foer the reply to this post.
Does my 16x16 icon then not conform to these values? I feel certain that I have seen other 16 x 16 icons loaded using LoadIcon before?
Does my 16x16 icon then not conform to these values? I feel certain that I have seen other 16 x 16 icons loaded using LoadIcon before?
Sorry it's taken so long to reply.
I'd use a MessageBox to display your SM_CXICON and SM_CYICON values. If there both not equal to 16 then LoadIcon won't work. If they both are equal to 16 then LoadIcon should work and the problem lies elsewhere.
[edited by - Solo on April 15, 2002 5:22:39 PM]
I'd use a MessageBox to display your SM_CXICON and SM_CYICON values. If there both not equal to 16 then LoadIcon won't work. If they both are equal to 16 then LoadIcon should work and the problem lies elsewhere.
[edited by - Solo on April 15, 2002 5:22:39 PM]
Always use LoadImage for this sort of thing. However, you don't need to use a WNDCLASSEX structure to create your window class. If you use a standard WNDCLASS (which has no hIconSm member) structure and RegisterClass , you'll still get a small icon displayed provided that the single icon you pass it contains a 16x16 format. If it doesn't, the system will create one from whatever size you give it.
[edited by - merlin9x9 on April 16, 2002 1:45:34 AM]
[edited by - merlin9x9 on April 16, 2002 1:45:34 AM]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement