MessageBox() Icon
How do you make an icon of your own appear on a MessageBox? Like, maybe through a resource file?
----------------------
Always will be smarter
than you,
--=ME=--
----------------------
You''ll need to use the MessageBoxIndirect function rather that MessageBox.
The MessageBoxIndirect prototype:
-Neophyte
MessageBoxIndirect (&p);
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GED d- s:+ a- C++$ UL++ P++ L++ E W+ N+ o K? w !O M--(+) V-- PS+
PE Y+ PGP t-- 5++ X+ R(+) rv+(++) b+++ DI+ D(+) G e+>++ h r--> y+
----- END GEEK CODE BLOCK-----
geekcode.com
The MessageBoxIndirect prototype:
int MessageBoxIndirect ( LPMSGBOXPARAMS lpMsgBoxParams)/* With the MSGBOXPARAMS: */typedef struct { UINT cbSize, HWND hwndOwner, HINSTANCE hInstance, LPCSTR lpszText, LPCSTR lpszCaption, DWORD dwStyle, LPCSTR lpszIcon, DWORD dwContextHelpId, MBGBOXCALLBACK lpfnMsgBoxCallback, DWORD dwLanguageId} MSGBOXPARAMS, *PMSGBOXPARAMS, FAR* LPMSGBOXPARAMS;/* For Instance: */// Create the parametersMSGBOXPARAMS p;p.cbSize = sizeof(p);p.hwndOwner = NULL;p.hInstance = g_hInstance;p.lpszText = "Fun with messageboxes";p.lpszCaption = "Hepp";p.dwStyle = MB_OK;p.lpszIcon = MAKEINTRESOURCE(IDI_MYICON1);p.dwContextHelpId = 0;p.lpfnMsgBoxCallback = NULL;p.dwLanguageId = MAKELANGID(LANG_NEUTRAL);// Show the messageboxMessageBoxIndirect (&p);
-Neophyte
MessageBoxIndirect (&p);
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
GED d- s:+ a- C++$ UL++ P++ L++ E W+ N+ o K? w !O M--(+) V-- PS+
PE Y+ PGP t-- 5++ X+ R(+) rv+(++) b+++ DI+ D(+) G e+>++ h r--> y+
----- END GEEK CODE BLOCK-----
geekcode.com
Can you give me an example in real a functioning program? (just the code in the .cpp).
----------------------
Always will be smarter
than you,
--=ME=--
----------------------
----------------------
Always will be smarter
than you,
--=ME=--
----------------------
He already gave you an example. If you need help with what the specific members of the MSGBOXPARAMS struct mean, then look it up yourself on MSDN.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement