warning_msg_box

 

Description

This is overload function, in order to call general warning message box simply

Syntax

int warning_msg_box( LPCSTR lpcszErrMsg, bool bShowBox, char cMsgType = 'W', UINT uType = MB_OK )

int warning_msg_box( LPCSTR lpcszErrMsg, int nParam, bool bShowBox, char cMsgType = 'W', UINT uType = MB_OK )

int warning_msg_box( int nErrCode, bool bShowBox, char cMsgType = 'W', UINT uType = MB_OK )

int warning_msg_box( int nErrCode, int nParam, bool bShowBox, char cMsgType = 'W', UINT uType = MB_OK )

int warning_msg_box( int nErrCode, LPCSTR lpcszParam, bool bShowBox, char cMsgType = 'W', UINT uType = MB_OK )

int warning_msg_box( int nErrCode, int nParam, LPCSTR lpcszParam, bool bShowBox, char cMsgType = 'W', UINT uType = MB_OK )

int warning_msg_box( int nErrCode, LPCSTR lpcszParam, int nParam, bool bShowBox, char cMsgType = 'W', UINT uType = MB_OK )

Parameters

lpcszErrMsg
[input] the error message
bShowBox
[input] Show message dialog box
cMsgType
[input] controlled by @NOW, @NOI, @NOE system variables
'W' for warning message, default = OUTMSG_CB_CMD_OUT
'I' for info message, default = OUTMSG_SCRIPT_WIN
'E' for error message, default = OUTMSG_SCRIPT_WIN_FORCE_OPEN
if bShowBox is true, this parameter will be ignored
uType
[input] Constants describing the characteristics of the message box. One constant from each group below
can be combined using the bitwise OR operator "|", default is MB_OK
Buttons on message box: MB_OK, MB_OKCANCEL, MB_ABORTRETRYIGNORE, MB_YESNOCANCEL, MB_YESNO,
MB_RETRYCANCEL
Icon on message box: MB_ICONHAND, MB_ICONQUESTION, MB_ICONEXCLAMATION, MB_ICONASTERISK,
MB_ICONINFORMATION, MB_ICONSTOP
Default button of message box: MB_DEFBUTTON1, MB_DEFBUTTON2, MB_DEFBUTTON3
Modality of message box: MB_APPLMODAL, MB_SYSTEMMODAL, MB_TASKMODAL
Mask of message box: MB_TYPEMASK, MB_ICONMASK, MB_DEFMASK, MB_MODEMASK, MB_MISCMASK
if bShowBox is false, this parameter will be ignored

lpcszErrMsg
nParam
bShowBox
cMsgType
uType

nErrCode
bShowBox
cMsgType
uType

nErrCode
nParam
bShowBox
cMsgType
uType

nErrCode
lpcszParam
bShowBox
cMsgType
uType

nErrCode
nParam
lpcszParam
bShowBox
cMsgType
uType

nErrCode
lpcszParam
nParam
bShowBox
cMsgType
uType

Return

return as MessageBox

No dialog, return 0.

Examples

EX1

void warning_msg_box_ex1()
{
    warning_msg_box("Error Message", true);
    warning_msg_box("Error Message with icon", true, ' ', MB_OK|MB_ICONEXCLAMATION);
    warning_msg_box("Error Message with cancel", (bool)TRUE, ' ', MB_OKCANCEL);
}

EX2

void warning_msg_box_ex2()
{
    warning_msg_box("The Line %d runtime error", 100, true);
    warning_msg_box("The Line %d runtime error", 100, true, ' ', MB_OK|MB_ICONHAND);
    warning_msg_box("The Line %d runtime error", 100, false, 'I', MB_OKCANCEL|MB_APPLMODAL);
}

EX3

void warning_msg_box_ex3()
{
    warning_msg_box(XFERR_UI_USER_CANCEL, true);
    warning_msg_box(XFERR_RUNTIME_EXCEPTION, false);
    warning_msg_box(XFERR_UI_USER_CANCEL, true, 'I', MB_OKCANCEL|MB_APPLMODAL);
}

EX4

void warning_msg_box_ex4()
{
    warning_msg_box(XFERR_UI_USER_CANCEL, 1, true);
    warning_msg_box(XFERR_RUNTIME_EXCEPTION, 1, false);
    warning_msg_box(XFERR_UI_USER_CANCEL, 1, true, ' ', MB_OKCANCEL|MB_APPLMODAL);
}

EX5

void warning_msg_box_ex5()
{
    warning_msg_box(IMPERR_NETCDF_NO_VARIABLE_FOUND, "Data1", true);
    warning_msg_box(IMPERR_NETCDF_NO_VARIABLE_FOUND, "Data1", true, MB_OKCANCEL);
}

EX6

void warning_msg_box_ex6()
{
    warning_msg_box(IMPERR_NETCDF_FAILED_IMPORT_1DIM_VARIABLE, "Data1", 1, true);
    warning_msg_box(IMPERR_NETCDF_FAILED_IMPORT_1DIM_VARIABLE, "Data1", 100, true, MB_OKCANCEL);
}

EX7

void warning_msg_box_ex7()
{
    warning_msg_box(IMPERR_NETCDF_FAILED_IMPORT_1DIM_VARIABLE, 1, "Data1", true);
    warning_msg_box(IMPERR_NETCDF_FAILED_IMPORT_1DIM_VARIABLE, 100, "Data1", true, MB_OKCANCEL);
}

Remark

See Also

header to Included

origin.h

Reference