Thread: RE: [GD-Windows] Icon for game window
Brought to you by:
vexxed72
From: Andrew G. <And...@ho...> - 2002-01-07 17:44:43
|
set WNDCLASS.hIcon before you register the class for your main window. Andrew Grant Hothouse Creations > -----Original Message----- > From: Brian Hook [mailto:bri...@py...] > Sent: 07 January 2002 17:34 > To: 'Gamedevlists-Windows@Lists. Sourceforge. Net' > Subject: [GD-Windows] Icon for game window > > > What magical bit of tomfoolery do I need to do to have my > application's > icon show up in the caption bar? I'm already using LoadIcon() to load > the correct icon, and it shows up correctly in Explorer when browsing > directories, just not in the caption. > > Thanks, > > Brian > > > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > This email is covered by the following disclaimer, please read before accepting this email. http://www.hothouse.org/disclaimer/ |
From: Rich <leg...@xm...> - 2002-01-07 17:49:31
|
In article <001a01c197a1$84d1df00$0101a8c0@HOOKDELL220>, Brian Hook <bri...@py...> writes: > What magical bit of tomfoolery do I need to do to have my application's > icon show up in the caption bar? MSDN Library January 2001 / Platform SDK / User Interface Services / Windows user Interface / Windowing / Windows / About Windows / Application Windows, in the section heading "Nonclient Area": ``The title bar displays an application-defined icon and line of text; typically, the text specifies the name of the application or indicates the purpose of the window. An application specifies the icon and text when creating the window. The title bar also makes it possible for the user to move the window by using a mouse or other pointing device.'' and in the reference for WNDCLASS: hIcon Handle to the class icon. This member must be a handle to an icon resource. If this member is NULL, the system provides a default icon. I beleive this is where you set it. -- Ask me about my upcoming book on Direct3D from Addison-Wesley! Direct3D Book <http://www.xmission.com/~legalize/book/> Don't Support Spammers! Boycott Fractal Painter 7! <http://www.xmission.com/~legalize/spammers.html> |
From: Jon W. <hp...@mi...> - 2002-01-07 17:57:08
|
> and in the reference for WNDCLASS: > > hIcon > Handle to the class icon. This member must be a handle to an icon > resource. If this member is NULL, the system provides a default > icon. There's also a hIconSm in the WNDCLASSEX structure. hIconSm Handle to a small icon that is associated with the window class. If this member is NULL, the system searches the icon resource specified by the hIcon member for an icon of the appropriate size to use as the small icon. http://msdn.microsoft.com/ It even has a useful "search" field (though I wish the default search scope would exclude all that Windows CE nonsense :-) Cheers, / h+ |
From: Andrew G. <And...@ho...> - 2002-01-07 17:50:53
|
Just incase you meant dynamically, you can use WM_SETICON to do the same thing at any time while your program is running. Andrew Grant Hothouse Creations > -----Original Message----- > From: Andrew Grant [mailto:And...@ho...] > Sent: 07 January 2002 17:45 > To: gam...@li... > Subject: RE: [GD-Windows] Icon for game window > > > set WNDCLASS.hIcon before you register the class for your main window. > > Andrew Grant > Hothouse Creations > > > > > -----Original Message----- > > From: Brian Hook [mailto:bri...@py...] > > Sent: 07 January 2002 17:34 > > To: 'Gamedevlists-Windows@Lists. Sourceforge. Net' > > Subject: [GD-Windows] Icon for game window > > > > > > What magical bit of tomfoolery do I need to do to have my > > application's > > icon show up in the caption bar? I'm already using > LoadIcon() to load > > the correct icon, and it shows up correctly in Explorer > when browsing > > directories, just not in the caption. > > > > Thanks, > > > > Brian > > > > > > _______________________________________________ > > Gamedevlists-windows mailing list > > Gam...@li... > > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > > > > > This email is covered by the following disclaimer, please read before > accepting this email. http://www.hothouse.org/disclaimer/ > > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > This email is covered by the following disclaimer, please read before accepting this email. http://www.hothouse.org/disclaimer/ |
From: Brian H. <bri...@py...> - 2002-01-07 17:51:25
|
A-ha! I was doing that, however I botched up the call to LoadIcon by passing NULL as the first parameter instead of hInstance. Doh. Thanks! Brian > -----Original Message----- > From: gam...@li... > [mailto:gam...@li...] On > Behalf Of Andrew Grant > Sent: Monday, January 07, 2002 9:45 AM > To: gam...@li... > Subject: RE: [GD-Windows] Icon for game window > > > set WNDCLASS.hIcon before you register the class for your main window. > > Andrew Grant > Hothouse Creations > > > > > -----Original Message----- > > From: Brian Hook [mailto:bri...@py...] > > Sent: 07 January 2002 17:34 > > To: 'Gamedevlists-Windows@Lists. Sourceforge. Net' > > Subject: [GD-Windows] Icon for game window > > > > > > What magical bit of tomfoolery do I need to do to have my > > application's > > icon show up in the caption bar? I'm already using > LoadIcon() to load > > the correct icon, and it shows up correctly in Explorer > when browsing > > directories, just not in the caption. > > > > Thanks, > > > > Brian > > > > > > _______________________________________________ > > Gamedevlists-windows mailing list > > Gam...@li... > > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > > > > > This email is covered by the following disclaimer, please > read before accepting this email. http://www.hothouse.org/disclaimer/ > > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > |
From: Roland <ro...@wi...> - 2002-01-07 21:35:54
|
Some more tips for icon handling: Icons can store multiple resolutions of the image in one file. Usually Windows finds the correct resolution to display, but sometimes this fails: In my particular case it fails whenever one creates a MFC dialog-based app. The wizard constructs code like this (in CXYZDlg::OnInitDialog()): // Set the icon for this dialog. The framework does this automatically // when the application's main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon The 'big icon' is displayed in the little ALT-TAB selection window. The 'small icon' is painted in the title bar and in the task bar entry. The problem is that this call always loads the big resolution of the icon. This looks good in the ALT-TAB case, but the title bar and task bar icon is resized (instead of taking the nicer-looking smaller resolution). My usual workaround is as follows: SetIcon(m_hIcon, TRUE); // Set big icon SetIcon((HICON) LoadImage( AfxGetResourceHandle(), MAKEINTRESOURCE(IDR_MAINFRAME), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR), FALSE); // Set small icon and voila: the small icon looks clean and nifty... Isn't directly related to your problem, though.... roland, fighting-for-nice-icons > -----Original Message----- > From: gam...@li... > [mailto:gam...@li...]On > Behalf Of > Brian Hook > Sent: Monday, January 07, 2002 9:51 AM > To: gam...@li... > Subject: RE: [GD-Windows] Icon for game window > > > A-ha! I was doing that, however I botched up the call to > LoadIcon by > passing NULL as the first parameter instead of hInstance. Doh. > > Thanks! > > Brian > > > > -----Original Message----- > > From: gam...@li... > > [mailto:gam...@li...] On > > Behalf Of Andrew Grant > > Sent: Monday, January 07, 2002 9:45 AM > > To: gam...@li... > > Subject: RE: [GD-Windows] Icon for game window > > > > > > set WNDCLASS.hIcon before you register the class for your > main window. > > > > Andrew Grant > > Hothouse Creations > > > > > > > > > -----Original Message----- > > > From: Brian Hook [mailto:bri...@py...] > > > Sent: 07 January 2002 17:34 > > > To: 'Gamedevlists-Windows@Lists. Sourceforge. Net' > > > Subject: [GD-Windows] Icon for game window > > > > > > > > > What magical bit of tomfoolery do I need to do to have my > > > application's > > > icon show up in the caption bar? I'm already using > > LoadIcon() to load > > > the correct icon, and it shows up correctly in Explorer > > when browsing > > > directories, just not in the caption. > > > > > > Thanks, > > > > > > Brian > > > > > > > > > _______________________________________________ > > > Gamedevlists-windows mailing list > > > Gam...@li... > > > > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > > > > > > > > > This email is covered by the following disclaimer, please > > read before accepting this email. > http://www.hothouse.org/disclaimer/ > > > > _______________________________________________ > > Gamedevlists-windows mailing list > > Gam...@li... > > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows > > > > > _______________________________________________ > Gamedevlists-windows mailing list > Gam...@li... > https://lists.sourceforge.net/lists/listinfo/gamedevlists-windows |
From: Brian H. <bri...@py...> - 2002-01-07 18:02:24
|
Jon, Thanks for the tip on searching MSDN, however, as you noted, the WinCE references and technical articles from Win3.0 are a bit much =) However, more important, I thought I WAS doing the right thing with the WNDCLASS structure, which is why I ended up asking this list (i.e. the icon was showing up fine on the desktop just not in the titlebar, so I had assumed that the two were different, when in fact I should have more correctly assumed I was a dork and getting something wrong =) ). As I said in the other e-mail, I was botching the call to LoadIcon(), so the problem was further upstream than I had expected. Thanks again, Brian |
From: Jon W. <hp...@mi...> - 2002-01-07 18:07:48
|
> Thanks for the tip on searching MSDN, however, as you noted, the WinCE > references and technical articles from Win3.0 are a bit much =) I've come to read the URLs directly, as they list the platform type in there. As long as the real hit is on the first page I'm usually doing OK :-) > However, more important, I thought I WAS doing the right thing with the > WNDCLASS structure, which is why I ended up asking this list (i.e. the Yes, I saw that: our messages crossed in the mail. My apologies. Cheers, / h+ |