Click to See Complete Forum and Search --> : Change the icon of a dialog


viewer
May 10th, 1999, 09:35 PM
How to change the icon of a dialog in program. I used SetIcon, SetWindowLong,
but there is no effect.

Bob Clarke
May 10th, 1999, 11:08 PM
Dialogs within apps typically don't have icons. Are you referring to an icon you have placed on your dialog?

May 11th, 1999, 05:48 AM
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

May 11th, 1999, 05:55 AM
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.