Advertisement Jump to content


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


Wheres my icon?

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

My new app uses DirectX in fullscreen and windowed mode. I copied most of the program code (window init etc..) from my other DX windowed app and all is fine, except im getting the standard win32 icon in the topleft corner of my window bar instead of my icon! (my other app had my custom icon there). The icon shows up when I see it in MyComputer, and as a shortcut, so the icon is loaded into the exe. heres my code: //--set up and register window class = CS_DBLCLKS;//CS_HREDRAW / CS_VREDRAW; wc.lpfnWndProc = WindowProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = LoadIcon( hInstance, MAKEINTATOM(GAME_ICON)); wc.hCursor = LoadCursor( NULL, IDC_ARROW ); wc.hbrBackground = GetStockBrush(BLACK_BRUSH); wc.lpszMenuName = NULL; wc.lpszClassName = NAME; rc = RegisterClass( &wc ); if ( !rc ) return FALSE; //-- create a window hWndMain = CreateWindowEx( WS_EX_APPWINDOW, NAME, TITLE, WS_VISIBLE / WS_SYSMENU / WS_POPUP, (GetSystemMetrics(SM_CXSCREEN)-640)/2, (GetSystemMetrics(SM_CYSCREEN)-480)/2, 640,//GetSystemMetrics(SM_CXSCREEN), 480,//GetSystemMetrics(SM_CYSCREEN), NULL, NULL, hInstance, NULL ); Anyone know why this is happening?

Share this post

Link to post
Share on other sites
Last time I actually bothered to set up an icon in a project was a long time ago... anyway here goes:

Here is how I generally do it:

// Define some icons
HICON hiSmall;
HICON hiLarge;
// Load the icons
hiLarge = LoadIcon(hThisInstance, MAKEINTRESOURCE(IDI_MAIN));

// Register window class:
WNDCLASSEX wndclass;
// add other stuff in wndclass then:
wndclass.hIcon = hiLarge;
wndclass.hIconSm = hiSmall;

// and that''s it

Just make sure that you have defined IDI_MAIN (so #include "resource.h" beforehand.)

-Big AL

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!