开发者

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

Wh开发者_开发百科ere 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:

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

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?


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜