6

Where do i find standard system icons of messageboxes via WinApi? I want to create an advanced dialogbox (with details-extension) as WinApi resource, but I want to use the system default icons like:

Standard system icons

For .NET I know that i'll find them in System.Drawing.SystemIcons, but where do I find them using native C and WinApi? And how could I apply them?

Christoph Meißner
  • 1,511
  • 2
  • 21
  • 40

2 Answers2

10

You should be able to get them using LoadIcon. To get the question mark icon use LoadIcon(NULL, IDI_QUESTION), the other identifiers are IDI_ERROR, IDI_WARNING and IDI_INFORMATION.

user786653
  • 29,780
  • 4
  • 43
  • 53
2

Thats correct,

If someone needs here my code to set the icon and also to play the corresponding sound.

HICON hIcon = NULL;
if(mbdIcon == MBD_ICON_INFORMATION) {
    hIcon = LoadIcon(NULL, IDI_INFORMATION);
    MessageBeep(MB_ICONASTERISK);
} else if(mbdIcon == MBD_ICON_QUESTION) {
    hIcon = LoadIcon(NULL, IDI_QUESTION);
    MessageBeep(MB_ICONQUESTION);
} else if(mbdIcon == MBD_ICON_WARNING) {
    hIcon = LoadIcon(NULL, IDI_WARNING);
    MessageBeep(MB_ICONWARNING);
} else if(mbdIcon == MBD_ICON_ERROR) {
    hIcon = LoadIcon(NULL, IDI_ERROR);
    MessageBeep(MB_ICONERROR);
} else {
    ShowWindow(hPictureIcon, SW_HIDE);
}
if(hIcon != NULL)
{
    Static_SetIcon(hPictureIcon, hIcon);
}

May it saves someone some minutes. :)

Christoph Meißner
  • 1,511
  • 2
  • 21
  • 40