How to change the icon of a dialog in program. I used SetIcon, SetWindowLong,
but there is no effect.
Printable View
How to change the icon of a dialog in program. I used SetIcon, SetWindowLong,
but there is no effect.
Dialogs within apps typically don't have icons. Are you referring to an icon you have placed on your dialog?
SetIcon works when called from within the dialog (e.g. I added a button on the dialog, and the handler changes the icon).
HICON m_hIcon; //in the CMyDialog header file
void CMyDialog::OnSetIconButton()
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MODALTYPE);
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
}
Derek
By the way, IDR_MODALTYPE is just the id of the icon that came for free with the app, as my app was called "Modal". Substitute the id of your alternative icon.
Derek.