Advertisement

The small icon doesn't show in taskbar?

Started by October 24, 1999 01:35 AM
7 comments, last by Void 25 years, 1 month ago
If you are using MFC in a funny way (which most of us do for game programming) or not using MFC at all, you need to set some of these yourself. The large icon is set by the call to AfxRegisterWndClass, but you can set the small one with:

SetIcon(AfxGetApp()->LoadIcon(IDR_MAINFRAME), FALSE);

The boolean specifies if you are setting the BIG icon (TRUE) or the SMALL icon (FALSE)

I'm using win32 and no it still doesn't show up even if I explicitly send a WM_SETICON message (which should be the SetIcon equiv).

Does it require registry entries or what?

Advertisement

I would like to know the answer to this one if there is a reasonable solution.

My understanding of the big and small icons is so that your application conforms to the windows display.

Windows actually selects which icon to display depending on the context of which it is viewed.

For instance, the big icon (32x32) is displayed in the task bar, while the small icon (16x16) is displayed when you view your .exe in explorer. If the small icon is not available, then the big icon is scaled to size.

-mordell

__________________________________________

Yeah, sure... we are laughing WITH you ...
I was under the same impression too but Starcraft is minimized, the spaceship icon shows beside its class name in the taskbar. Mine doesn;t, although the icon is displayed in the file executable when I choose view large/small icon.

Every active program has an icon besides the class name in the taskbar, except mine? What else do I set to set besides the icon while registering the class?


Ahhh....apologies!

I was under the impression you wanted your small icon to appear in the task bar, not that you didn't see your icon at all in the task bar!

I guess make sure that when you are building your WNDCLASSEX data you verify that LoadIcon succeeds.

Also, in the case of dialogs, you can set the icon like so:

SendMessage(hwndDlg, WM_SETICON, ICON_BIG,
(LPARAM)LoadIcon(hApp, MAKEINTRESOURCE(IDI_ICON)));


hmm..I was toying around with getting the small icon to appear in the caption and the task bar and this seems to work:

wcex.hIconSm = (HICON)LoadImage(hInstance, MAKEINTRESOURCE(IDI_WIN32), IMAGE_ICON, 16, 16, 0);

The icon IDI_WIN32 contains both a 32x32 and a 16x16 icon, LoadImage apparently loaded the correct icon based on the size params I passed in.

Afraid thats not a whole lot of help with your problem, tho. Maybe if you post your window registration code..?

-mordell

__________________________________________

Yeah, sure... we are laughing WITH you ...
Thanks but I have found the answer.

You need to set the CS_SYSMENU flag when u register the class or the icon will never show. I guess MFC does that behind the scenes but too bad I'm not using it.

but in doing so I seem to find a disturbing fact about dx. Will post more of it once I tested my findings.

Advertisement

Void,

Where did you find information about CS_SYSMENU? What does it do?

I have never used it. The only style flags I have ever used when registering a class is CS_HREDRAW | CS_VREDRAW and occasionally CS_OWNDC...thats about it.

The only reason I mention it is because I do not use MFC, and my apps have always had an icon in the taskbar or caption. The only thing I do is set the icon params of the WNDCLASSEX structure prior to RegisterClassEx.

ack! I just thought of something! Do you mean WS_SYSMENU, a style flag used in the call to CreateWindowEx? That could be it then, I typically use the WS_OVERLAPPEDWINDOW style, which includes WS_SYSMENU. That could explain it.

-mordell

__________________________________________

Yeah, sure... we are laughing WITH you ...
Hi,

I was under the impression the taskbar would show the small icon besides the class name when u set the wndclass icon member but it seems not to?

Anyone knows how to do it?

Yes.. sorry about it.

it is WS_SYSMENU, not CS_SYSMENU...

An very annoying undocumented feature.

This topic is closed to new replies.

Advertisement