|
-
Jan 30th, 2002, 04:15 PM
#1
Thread Starter
Member
icon of dialog
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.
-
Jan 30th, 2002, 09:08 PM
#2
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.
-
Jan 31st, 2002, 01:57 PM
#3
Thread Starter
Member
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.
-
Mar 17th, 2003, 07:32 PM
#4
Stuck in the 80s
Anyone have an answer to this?
-
Mar 22nd, 2003, 06:15 PM
#5
Pass your resource handle instead of NULL. Something like AfxGetApp()->hResource
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|