Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where do i find standard system icons of messageboxes via WinApi?

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?

like image 774
Christoph Meißner Avatar asked Sep 07 '11 10:09

Christoph Meißner


2 Answers

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.

like image 194
user786653 Avatar answered Sep 24 '22 20:09

user786653


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. :)

like image 39
Christoph Meißner Avatar answered Sep 20 '22 20:09

Christoph Meißner