just new to MFC...... I couldn't put an icon to a dialog box( CMyDlg:CDlg)......like icon of the form in Vb....can you tell me?
Thanks.
Printable View
just new to MFC...... I couldn't put an icon to a dialog box( CMyDlg:CDlg)......like icon of the form in Vb....can you tell me?
Thanks.
In the OnCreate() message handler you can use CWnd::SetIcon()
The dialog class, CDialog, is derived from CWnd... if you didn't know...
so you could just do this
Code:
int CAboutDlg::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CDialog::OnCreate(lpCreateStruct) == -1)
return -1;
SetIcon( LoadIcon( IDI_SMALLICON ), FALSE );
SetIcon( LoadIcon( IDI_BIGICON ), TRUE );
return 0;
}
If this doesn't work, try putting it in the OnInitDialog() message handler.
I tried but can only display standard icon by this:
........
SetIcon( LoadIcon( NULL, IDI_ASTERISK), TRUE );
........
when I changed it to my icon:
SetIcon( LoadIcon( NULL, MAKEINTRESOURCE(IDI_ICON1)), TRUE );
nothing is display there. why?
Thanks lot.
Anyone have an answer to this? :(
Pass your resource handle instead of NULL. Something like AfxGetApp()->hResource