• Advertisement

Archived

This topic is now archived and is closed to further replies.

MessageBox() Icon

This topic is 5757 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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=-- ----------------------

Share this post


Link to post
Share on other sites
Advertisement
You''ll need to use the MessageBoxIndirect function rather that MessageBox.
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 parameters

MSGBOXPARAMS 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 messagebox

MessageBoxIndirect (&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

Share this post


Link to post
Share on other sites
Can you give me an example in real a functioning program? (just the code in the .cpp).

----------------------
Always will be smarter
than you,
--=ME=--
----------------------

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

  • Advertisement