Jump to content
  • Advertisement
Sign in to follow this  
ChaosPhoenix

Setting an Icon without using Afx MFC calls.

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

There has to be a way to do this, but all my research has turned up nothing. I have a project in Visual Studio 2003. It was created as an empty Win32 project. While the game is running in Windowed mode I'd like to display an icon instead of the default white icon. I've already created the icon resource, added it to the project, but I can't for the life of me figure out how to actually load the icon within the code. All the resources I've found have pointed me to using AFX function calls - which I cannot do since this is a D3D app that includes Windows.h. Surely by having the handle to the window I can set the icon without using any Afx function calls. How can I set the icon?

Share this post


Link to post
Share on other sites
Advertisement
Well, if you just want one icon for the whole time the program is running you'd usually set it up as part of your window class (see RegisterClassEx and WNDCLASSEX).

I can't find any way to set it dynamically, the only thing I can think of would be a WM_NCPAINT hack, but that would get really messy.

Share this post


Link to post
Share on other sites
You should set the icon in your WNDCLASS when you register it. If you can't do that, you can send your window a WM_SETICON message (I hope the link works, my DNS is screwed just now) to set the icon.

Share this post


Link to post
Share on other sites
I'm using some weird platform (can't give the name out, sorry) and it looks like it found the icon after I created the resource for it ( I didn't notice it till I did a full rebuild).

Thanks for the information anyway guys.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!