Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

NightZero

Icons

This topic is 5605 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I can''t get those small icons in the windows caption to work! I have tried to make 16*16 pixel icons but, Visual Studio converts them to 32*32, by adding transparent background. Ihe icons look fine in for example file explorer, but i cont get them into that darn window caption! WNDCLASSEX wc; wc.cbClsExtra=0; wc.cbSize=sizeof(WNDCLASSEX); wc.cbWndExtra=0; wc.hbrBackground=(HBRUSH)GetStockObject(BLACK_BRUSH); wc.hCursor=LoadCursor(NULL,IDC_ARROW); wc.hIcon=LoadIcon(NULL,MAKEINTRESOURCE(IDI_BIG)); wc.hIconSm=LoadIcon(NULL,MAKEINTRESOURCE(IDI_SMALL)); wc.hInstance=hInstance; wc.lpfnWndProc=WndProc; wc.lpszClassName="wc"; wc.lpszMenuName=0; wc.nostyle=CS_HREDRAW|CS_VREDRAW; Even if i use the big icon in wc.hIconSm=LoadIcon(NULL,MAKEINTRESOURCE(IDI_SMALL)); it should be stretched?! But I always get the default icon. The application .EXE icon works fine! Regards, Mattias

Share this post


Link to post
Share on other sites
Advertisement
Try passing the prog hinstance to LoadIcon instead of NULL.

HICON LoadIcon(
HINSTANCE hInstance, // handle to application instance
LPCTSTR lpIconName // name string or resource identifier
);

HINSTANCE hInstance,

"Handle to an instance of the module whose executable file contains the icon to be loaded. This parameter must be NULL when a standard icon is being loaded."





"Beautiful maiden," answered Candide, "when a man is in love, is jealous, and has been flogged by the Inquisition, he becomes lost to all reflection."

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by NightZero
I have tried to make 16*16 pixel icons but, Visual Studio converts them to 32*32, by adding transparent background.

i''m not sure what you mean by this. are you saying you create an icon resource using the resource editor and it always ends up as a 32x32 icon?

if so, try using the menu option Image->New Device Image and then specifying 16x16x256 via the Custom button. you can actually use this functionality to put multiple icon images, each a different size and/or color depth, into the same icon resource. you want to do this anyway since Explorer uses the "first" icon resource (lowest ordinal value) it finds in an exe for display purposes, no matter what the view mode is.

but, if that statement is just related to the others you made, the reason your small icons aren''t showing up correctly is that you are using the LoadIcon api call, which only supports "default" icon size loading (as stated in the docs, btw ). what you need to use when setting your Window classes small icon is the LoadImage api call, specifying GetSystemMetrics(SM_CXSMICON) and GetSystemMetrics(SM_CYSMICON) as the image width and height, respectively.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by LessBread
Try passing the prog hinstance to LoadIcon instead of NULL.



Yes, alternatively, if you don''t have the HINSTANCE accessible in the function you''re using, you can obtain it via GetModuleHandle(NULL)

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!