Jump to content
  • Advertisement

Archived

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

emileej

Windows: Setting the window icon

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

In my window class I have set the icons like this:
wc.hIcon		= LoadIcon(hInstance,"IDI_MAIN");
wc.hIconSm		= LoadIcon(hInstance,"IDI_MAIN");
But I get the windows logo as window icon. What an I doing wrong? "On a long enough timeline the survival rate of everyone drops to zero" - Fight Club

Share this post


Link to post
Share on other sites
Advertisement

mmh...try using:

>>wc.hIco = LoadIcon( hInstance, (LPCSTR)"IDI_MAIN" );

and rename your icon to another name - i have experienced some problems if the itom carries general names like IDI_MAIN.
and: what type is wc of ? WNDCLASS or WNDCLASSEX ?
i''m using WNDCLASSEX an it works fine for me.



DJSnow
---
this post is manually created and therefore legally valid without a signature

Share this post


Link to post
Share on other sites
I have tried renaming the icon, doing that typecast and attempted to set wc.hIco (I take it is a type as that is not a part of WNDCLASSEX). So that also ansvers your question regarding the type of wc.

Share this post


Link to post
Share on other sites
Hi,


dont use WMCLASS to set Window icon !
use this ;

SendMessage(currentWindowHWND, WM_SETICON, NULL, (LPARAM)LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_YOUR_ICON)));


use this function in each window you want to see your own icon.



:-)

Share this post


Link to post
Share on other sites
With the resource editor you have to add an icon.
you name your icon ID_WHAT_YOU_WANT (ID_MAIN if u want)
then make sure the resource ed have updated the resource header (.h)

then in your program dont forget to include the resource header ! So when you use ID_WHAT_YOU_WANT it will not display this error !

Share this post


Link to post
Share on other sites
The WMCLASS hIcon & hInconSm sets the program (file) icon, not the windows titlebar icon !

if you want to have title bar icon, use the function listed above.

Share this post


Link to post
Share on other sites
quote:
Original post by encom
The WMCLASS hIcon & hInconSm sets the program (file) icon, not the windows titlebar icon !


Not really. The icon of the program file is the icon with the lowest numeric ID.

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!