Take the 2-minute tour ×

I just switched the game to use WNDCLASSEX so I can change the hIconSm, but for some reason there isn't an icon in the title bar anymore. The cursor and icon on the task bar and the icon for the EXE are all working fine though. Here is the main part of the window creation code:


 wc.cbSize = sizeof(WNDCLASSEX);
 wc.cbClsExtra = 0;
 wc.cbWndExtra = 0;
 wc.style = CS_HREDRAW | CS_VREDRAW;
 wc.lpfnWndProc = WinProc;
 wc.hInstance = hInstance;
 wc.hIcon = LoadIcon(NULL, IDI_ERROR);
 wc.hIconSm = LoadIcon(NULL, IDI_ASTERISK);
 wc.hCursor = LoadCursorFromFile((LPCSTR)"FierceCursor.cur");
 wc.hbrBackground = (HBRUSH) (COLOR_WINDOW+1);
 wc.lpszClassName = "FierceWindow";


 game->hinstance = hInstance;

 hWnd = CreateWindowEx(WS_EX_CLIENTEDGE,
                          "FierceWindow", "Fierce",
                          WS_OVERLAPPED, 400, 100,
                          game->SCREEN_WIDTH, game->SCREEN_HEIGHT,
                          NULL, NULL, hInstance, NULL);

I've tried a few different settings for CreateWindowEx in hopes that maybe I used a style without an icon, but no luck. I'm using default icons right now to test.

share|improve this question
add comment

2 Answers

Won't compile:


Thanks for the edit btw.

Edit - Got it to compile by changing it to:

    wc.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(32513));
wc.hIconSm = LoadIcon(hInstance, MAKEINTRESOURCE(32513));
share|improve this answer
@MJ: deleted...sorry. –  sje397 Dec 16 '10 at 4:46
I got it to work but still no icon. :( –  Michael Jackson Dec 16 '10 at 4:48
Does it work if you just use CreateWindow? –  Tola Odejayi Dec 16 '10 at 4:58
When I used WNDCLASS, RegisterClass(), and CreateWindow() it worked. I changed it so I could change the icon that's not showing up. –  Michael Jackson Dec 16 '10 at 5:02
add comment

It's because of your window style. The icon appears only if you add WS_SYSMENU style.


share|improve this answer
add comment

Your Answer


