XLL+ Class Library

CXllApp::XlMessageBox

Display the Excel message box

[C++]
static BOOL XlMessageBox(
   const char* pszText,
   USHORT usType
);

Parameters

pszText

A null-terminated string that will be displayed in the message box.

usType

If usType is XlMessageBoxTypeQuestion (1), XlMessageBox will display a dialog with OK and Cancel buttons; the icon will be a question mark. If usType is XlMessageBoxTypeInformation (2), then an information icon will be displayed, and only the OK button will be available. If usType is XlMessageBoxTypeExclamation (3), then a warning icon will be displayed, and only the OK button will be available.

Return value

TRUE if the user presses OK; FALSE if the user presses Cancel

Remarks

This function displays an Excel message box containing the text parameter, an icon, the OK button and optionally the Cancel button. It is equivalent to calling the Excel ALERT macro.

Since the function is static, it is not necessary to use an instance of CXllApp to invoke it. It is not therefore necessary to fix the MFC CWinApp instance using the XLL_FIX_STATE macro: you can use code such as:

if ( CXllApp::XlMessageBox("Refresh data now?", 1) )
    RefreshData();

If you need more flexibility from a message box, use the Windows MessageBox via CXllApp::WinMessageBox, or create your own dialog class and show it using an instance of as the parent CWnd.

Requirements

Header: xllplus.h

See Also

CXllApp Class | CXllApp Methods | CXllApp::WinMessageBox | CXllApp::XlHwnd | CExcelWnd