A standard icon within a custom dialog

Started by
3 comments, last by Chaucer 20 years, 1 month ago
Is there a way in the visual studio dialog editor to place a standard icon (IDI_EXCLAMATION) within a custom dialog? Or would I have to include it somehow in the code? thanks.
Thanks!
Advertisement
I don't think you can do it directly through the dialog editor, but it's a pretty simple process to code. After you get the WM_INITDIALOG message, do the following:

SendMessage(hwndIcon, STM_SETICON, (WPARAM)LoadIcon(NULL, IDI_EXCLAMATION), 0);

where hwndIcon is the window handle to a static icon control.

[edited by - aprosenf on March 25, 2004 6:28:43 PM]
hmm. Is that going to set the icon at the top left corner? I''d like to be able to place it in a specific spot on the dialog..

I''m using mfc so i''ve got an OnInitDialog method.

I could do a SetIcon, but I thought that set the icon in the top left...
Thanks!
quote:STM_SETICON Message

An application sends the STM_SETICON message to associate an icon with an icon control.

It sets the icon for an icon (static) control
quote:Original post by Chaucer
hmm. Is that going to set the icon at the top left corner? I''d like to be able to place it in a specific spot on the dialog..


Create a CStatic and use CStatic::SetIcon().

Thanks Salsa!Colin Jeanne | Invader''s Realm
"I forgot I had the Scroll Lock key until a few weeks ago when some asshole program used it. It even used it right" - Conner McCloud

This topic is closed to new replies.

Advertisement