Archived

This topic is now archived and is closed to further replies.

A standard icon within a custom dialog

This topic is 5012 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites