Jump to content
  • Advertisement

Archived

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

HellspawnXIII

Creating a button w/ icon - MFC

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

Does anyone know how to create a button (CButton) with an icon in it instead of text? I''ve done some research and so far I have: h_icon = LoadIcon(NULL, MAKEINTRESOURCE(IDI_CLOSE)); m_bClose.SetIcon(h_icon); Also, in the resource editor, I have the the Icon style box checked. Everything compiles fine, but my button is empty! Any thoughts?
HellspawnXIII Build a man a fire, and he''ll be warm for a day. Set him on fire, and he''ll be warm for the rest of his life.

Share this post


Link to post
Share on other sites
Advertisement
Nevermind, I found the solution:

The NULL in the function LoadIcon shouldn''t be NULL - it has to be the instance of my app.

Silly me.


HellspawnXIII
Build a man a fire, and he''ll be warm for a day. Set him on fire, and he''ll be warm for the rest of his life.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Correct, hInstance should be NULL ONLY while loading a non-standard icon ... taken directly from VS .NET SDK:



hInstance

[in] 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.

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!