Jump to content
  • Advertisement

Archived

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

SikCiv

Wheres my icon?

This topic is 6689 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 wc.style = 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
Advertisement
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
hiSmall = (HICON)LoadImage(hThisInstance, MAKEINTRESOURCE (IDI_MAIN), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
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 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!