Sign in to follow this  

Having trouble using an icon

This topic is 4298 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

(Using: Microsoft Visual C++ 6.0 Introductory Edition compiler) I'm trying to use a custom icon for my program. So I hit Insert->Resource->Icon. And I draw an icon. Then I load it in my program, and it works. Then I try to make a small icon for my program. And that's where I'm having trouble. When I hit Insert->Resource->Icon, by default it's 32x32. I need a 16x16 icon for the small one. So I hit new device image and click Small (16x16). Then I try to load that as my small icon. But it doesn't work. I haven't messed with icons much before, but it seems like they store multiple images of different sizes in them, right? Like a single icon file could have a 32x32 one and a 16x16. Well, when I try to load the small icon, it instead loads the 32x32 one, which doesn't work because it's not hte right size. So how either do I get rid of the 32x32 image out of my icon, or how do I specify it to use the 16x16 image? Any help would be appreciated. Thanks in advance.

Share this post


Link to post
Share on other sites
I load it in when I create my windows class:

WNDCLASSEX wc;
wc.hIcon = LoadIcon(NULL, (LPCTSTR)IDI_ICONNAME);
wc.hIconSm = LoadIcon(NULL, (LPCTSTR)IDI_ICONNAME);

Share this post


Link to post
Share on other sites
i think you need to load the icon from the application's instance
like this

WNDCLASSEX wc;
wc.hIcon = LoadIcon(hInstance,MAKEINTRESOURCE(IDI_ICONNAME32x32));
wc.hIconSm = LoadIcon(hInstance,MAKEINTRESOURCE(IDI_ICONNAME16x16));

i hope this helps...

Share this post


Link to post
Share on other sites
Ah, thanks. It sort of works now. But instead of loading the 16x16 image, it just takes the 32x32 one and shrinks it down so it will fit in the upper left corner (because my small icon still has a 32x32 device image or whatever, which I don't know how to get rid of).

Share this post


Link to post
Share on other sites

This topic is 4298 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this