• 0

[c/c++][winapi] MessageBoxIndirect question


Question

Here's the code:

HINSTANCE hDllModule = LoadLibrary("shell32.dll");
MSGBOXPARAMS mbp;
mbp.hwndOwner = hwnd;
mbp.hInstance = hDllModule;
mbp.lpszText = " ";
mbp.lpszCaption=" ";
mbp.dwStyle = MB_OK|MB_USERICON;
mbp.lpszIcon = MAKEINTRESOURCE(6);
MessageBoxIndirect(&mbp);

I get no icon. (Yes, the icon id is valid.)

Is it possible to pass a non-resource to lpszIcon? Such as a path to an ico file, an icon from a dll, or an icon handle?

If so, how?

Link to comment
https://www.neowin.net/forum/topic/898938-ccwinapi-messageboxindirect-question/
Share on other sites

6 answers to this question

Recommended Posts

  • 0

MSGBOXPARAMS

lpszIcon: This parameter can be either a null-terminated string or an integer resource identifier passed to the MAKEINTRESOURCE macro.

Are you trying to retrieve the 6th icon resource from shell32.dll? You should be checking to make sure hDllModule is not null. Also, I think you should be using LoadLibraryEx("shell32.dll", 0, LOAD_LIBRARY_AS_DATAFILE).

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.