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

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


Adding ICON to modless dialog Caption

Lynn Herrera -- lherrera@kofax.com
Tuesday, June 11, 1996


     VC4.1 NT3.51
     
     I am creating a modeless dialog that needs it own ICON in the caption.
     Currently (by default) the Microsoft flag is displayed.
     
     Lynn
     
     lherrera@kofax.com



Frederic Steppe -- FredericS@msn.com
Thursday, June 13, 1996

[Mini-digest: 4 responses]

>VC4.1 NT3.51
>
>I am creating a modeless dialog that needs it own ICON in the caption.
>Currently (by default) the Microsoft flag is displayed.

This is the way AppWizard handles your problem when building a dialog-based 
executable :

Declare a HICON member m_hIcon, then load it in your dialog's constructor :

	m_hIcon = AfxGetApp()->LoadIcon(IDD_MYDIALOGICON);

Assign the icon to the dialog in your OnInitDialog override :

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


Frederic Steppe (frederics@msn.com)

-----From: "Stacey Blaschke" 

You can use the function CWnd::SetIcon - I use it in some of my apps 
to do the same thing you are asking about.

 HICON hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
 ASSERT(hIcon != NULL);
 SetIcon(hIcon, FALSE); //pass FALSE for a 16X16 icon

If you are setting a 32 X 32 icon set the second parameter of SetIcon to TRUE.

Stacey Blaschke
Stacey_Blaschke@msn.com

-----From: funduc@sprynet.com

Use SetIcon().  See the Doco for flags (SMALL or LARGE).  I'd set both.

Mike Funduc
Funduc Software Inc.
102372.2530@compuserve.com
funduc@sprynet.com
http://ourworld.compuserve.com/homepages/funduc
http://home.sprynet.com/sprynet/funduc
-----From: Mario Contestabile

> I am creating a modeless dialog that needs it own ICON in the caption.
>  Currently (by default) the Microsoft flag is displayed.
>  Lynn

OnInitDialog(){
...
HICON cute = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
if(cute)
   SetClassLong(GetSafeHwnd(), GCL_HICON, (LONG)cute);
}

mcontest@universal.com





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