top-left corner icon on a dialog from resources in C++

thank you in advance.

I'm developing an application in Win32 C++ which its main window comes up from a resource file because it's easier to place controls.

to that I use CreateDialog a statement

The problem is, I don't achieve to put it an Icon such as I could with CreateWindow statement at the WNDCLASSEX sctructure.

does somebody know the way to get a dialog with that top-left-corner Icon?

Thanks

Upvotes: 1

Views: 1316

Answers (2)

Andrew Komiagin
Andrew Komiagin

Reputation: 6556

You can enable your application to display an icon in the title bar of a dialog box by adding the WS_SYSMENU and WS_CAPTION styles to the dialog box template and sending the WM_SETICON message from within the dialog box procedure in response to the WM_INITDIALOG message.

Upvotes: 3

David Heffernan
David Heffernan

Reputation: 612794

CreateDialog returns the window handle of the dialog. Send that window WM_SETICON messages to specify the icon for the window. Or indeed send the messages in response to WM_INITDIALOG.

Upvotes: 1

Related Questions