Error specify the lpszIcon in the MSGBOXPARAM using ::LoadIcon
-
In the MSDN, it says below: lpszIcon Identifies an icon resource. This parameter can be either a null-terminated string or an integer resource identifier passed to the MAKEINTRESOURCE macro. To load one of the standard system-defined icons, set the hInstance member to NULL and set lpszIcon to one of the values listed with the LoadIcon function. This member is ignored if the dwStyle member does not specify the MB_USERICON flag.
MSGBOXPARAMS msgparam = {0}; msgparam.cbSize = sizeof(MSGBOXPARAMS); msgparam.hwndOwner = NULL; msgparam.lpszText = \_T("text"); msgparam.lpszCaption = \_T("caption"); msgparam.dwStyle = MB\_USERICON | MB\_OK; msgparam.hInstance = NULL; msgparam.lpszIcon = ::LoadIcon(NULL, IDI\_WINLOGO); I want to use as the MSDN says.Actually I know it will compile error. ::MessageBoxIndirect(&msgparam);
-
In the MSDN, it says below: lpszIcon Identifies an icon resource. This parameter can be either a null-terminated string or an integer resource identifier passed to the MAKEINTRESOURCE macro. To load one of the standard system-defined icons, set the hInstance member to NULL and set lpszIcon to one of the values listed with the LoadIcon function. This member is ignored if the dwStyle member does not specify the MB_USERICON flag.
MSGBOXPARAMS msgparam = {0}; msgparam.cbSize = sizeof(MSGBOXPARAMS); msgparam.hwndOwner = NULL; msgparam.lpszText = \_T("text"); msgparam.lpszCaption = \_T("caption"); msgparam.dwStyle = MB\_USERICON | MB\_OK; msgparam.hInstance = NULL; msgparam.lpszIcon = ::LoadIcon(NULL, IDI\_WINLOGO); I want to use as the MSDN says.Actually I know it will compile error. ::MessageBoxIndirect(&msgparam);
:confused: What is the problem ? What is your question in fact ? Di you have a compilation error ? If yes, why don't you simply put the exact error message so we can try to help you ?
Cédric Moonen Software developer
Charting control [v1.4] OpenGL game tutorial in C++ -
In the MSDN, it says below: lpszIcon Identifies an icon resource. This parameter can be either a null-terminated string or an integer resource identifier passed to the MAKEINTRESOURCE macro. To load one of the standard system-defined icons, set the hInstance member to NULL and set lpszIcon to one of the values listed with the LoadIcon function. This member is ignored if the dwStyle member does not specify the MB_USERICON flag.
MSGBOXPARAMS msgparam = {0}; msgparam.cbSize = sizeof(MSGBOXPARAMS); msgparam.hwndOwner = NULL; msgparam.lpszText = \_T("text"); msgparam.lpszCaption = \_T("caption"); msgparam.dwStyle = MB\_USERICON | MB\_OK; msgparam.hInstance = NULL; msgparam.lpszIcon = ::LoadIcon(NULL, IDI\_WINLOGO); I want to use as the MSDN says.Actually I know it will compile error. ::MessageBoxIndirect(&msgparam);
msgparam.lpszIcon = (LPCTSTR)::LoadIcon(NULL, IDI_WINLOGO);
;) [added] BTW: see here [^]. [/added] [added] BTW2: Xing Chen's solution [^] actually works. [/added]
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles]modified on Friday, August 1, 2008 3:52 AM
-
:confused: What is the problem ? What is your question in fact ? Di you have a compilation error ? If yes, why don't you simply put the exact error message so we can try to help you ?
Cédric Moonen Software developer
Charting control [v1.4] OpenGL game tutorial in C++//msgparam.lpszIcon = ::LoadIcon(NULL, IDI_WINLOGO); msgparam.lpszIcon = MAKEINTRESOURCE(IDI_WINLOGO); The MSDN has fooled me, or I misunderstand the MSDN words, I should just use MAKEINTRESOURCE, not using ::LoadIcon.
-
In the MSDN, it says below: lpszIcon Identifies an icon resource. This parameter can be either a null-terminated string or an integer resource identifier passed to the MAKEINTRESOURCE macro. To load one of the standard system-defined icons, set the hInstance member to NULL and set lpszIcon to one of the values listed with the LoadIcon function. This member is ignored if the dwStyle member does not specify the MB_USERICON flag.
MSGBOXPARAMS msgparam = {0}; msgparam.cbSize = sizeof(MSGBOXPARAMS); msgparam.hwndOwner = NULL; msgparam.lpszText = \_T("text"); msgparam.lpszCaption = \_T("caption"); msgparam.dwStyle = MB\_USERICON | MB\_OK; msgparam.hInstance = NULL; msgparam.lpszIcon = ::LoadIcon(NULL, IDI\_WINLOGO); I want to use as the MSDN says.Actually I know it will compile error. ::MessageBoxIndirect(&msgparam);
set lpszIcon to one of the values listed with the LoadIcon function means: lpszIcon can be one of these value: IDI_APPLICATION IDI_ASTERISK IDI_ERROR IDI_EXCLAMATION IDI_HAND IDI_INFORMATION IDI_QUESTION IDI_WARNING IDI_WINLOGO so you can use them directly.
msgparam.lpszIcon = IDI_WINLOGO;