15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


Incorrect icon for dialog-based app

Paul D. Bartholomew -- PaulDB@datastorm.com
Monday, September 30, 1996


Environment: VC++ 4.0, Windows 95

I have a dialog-based application created using the AppWizard.   
 Associated with this application is an icon file that contains both   
16x16 and 32x32 icons.  These icons are being loaded properly in the   
OnInitDialog function for the main dialog.  This dialog-based   
application, like most Windows 95 applications, contains a 16x16 icon in   
the upper left corner of the dialog when it's running.  Unfortunately,   
this is not the 16x16 icon that the application loaded--it's a compressed   
version of the 32x32 icon.  Is there any way to force this application to   
use the proper icon?

Paul Bartholomew
pauldb@datastorm.com



Paul D. Bartholomew -- PaulDB@datastorm.com
Tuesday, October 01, 1996

[Mini-digest: 4 responses]

Environment: VC++ 4.0, Windows 95

>>I have a dialog-based application created using the AppWizard.   
  Associated with this application is an icon file that contains both   
16x16 and 32x32 icons.  These icons are being loaded properly in the   
OnInitDialog function for the main dialog.  This dialog-based   
application, like most Windows 95 applications, contains a 16x16 icon in   
the upper left corner of the dialog when it's running.  Unfortunately,   
this is not the 16x16 icon that the application loaded--it's a compressed   
version of the 32x32 icon.  Is there any way to force this application to   
use the proper icon?<<

I'm now able to answer my own question, with the help of one of my   
colleagues.  The AppWizard had added the following commands to the   
OnInitDialog function for this app:

 SetIcon(m_hIcon, TRUE);
 SetIcon(m_hIcon, FALSE);

The variable, m_hIcon, had been initialized in the constructor with a   
call to LoadIcon.  Removing the second SetIcon function call above solved   
my problem.  That second call is supposed to be setting the 16x16 icon   
for my application, but it was apparently not able to locate the 16x16   
icon in the icon resource, so it simply compressed the 32x32 icon   
instead.

Paul Bartholomew
pauldb@datastorm.com
-----From: "Tim Dieckman" 

I ran into the same problem.  AppWizard sticks these two lines in your
OnInitDialog handler:

SetIcon(m_hIcon, TRUE);	// Set big icon
SetIcon(m_hIcon, FALSE);	// Set small icon

If you comment the second line out, you will get the correct icon for your
small icon in the caption of your dialog frame AND for the large icon in the
windows that is displayed when you Alt-Tab between applications.

Tim
-----From: Mario Contestabile

I think what you are experiencing is a documentation bug. I think
it states incorrectly that it uses the 16x16 icon, when in fact it is the 32x32 
icon
used.....

mcontest@universal.com

-----From: "Ed Lenox" 


I have noticed this also. What I do is use different icon files for the
different sizes. i.e. remove the 32x32 image and if you need that someplace
put it in a different icon resource. This probably is not what you need
however.

I also notice that my icons seem to display badly in the titlebar, even
when using the 16x16 icons only. If anyone has information on this subject
I would be interested in hearing about it.

Ed Lenox
Powercom-2000 Ireland

edlenox@indigo.ie




| Вернуться в корень Архива |