|
[code]第一、在对话框的构造函数中修改:
CSetIconDlg::CSetIconDlg(CWnd* pParent )
: CDialog(CSetIconDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CSetIconDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
// 加入下面的代码(IDI_ICON2:图标的ID号)
m_hIcon = AfxGetApp()->LoadIcon(IDI_ICON2);
}
第二、在初始化事件中
BOOL CSetIconDlg::OnInitDialog()
{
CDialog::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
// TODO: Add extra initialization here
return TRUE; // return TRUE unless you set the focus to a control
}
运行起来看看吧![/code] |
|