Skip to main content
gamedev.net
🔒 Locked

Wheres my icon?

Started by SikCiv Jun 26, 2000 at 9:40 PM 1 replies 250+ views
Original Post
SikCiv
SikCiv
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?
  Downloads:  ZeroOne Realm
Big Al
Big Al
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

SikCiv
SikCiv
Thanks ill try it..
  Downloads:  ZeroOne Realm

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.