home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
HomeWare 14
/
HOMEWARE14.bin
/
os2
/
cenv2_19.arj
/
MSGBOX.LIB
< prev
next >
Wrap
Text File
|
1994-03-08
|
4KB
|
68 lines
// MsgBox.lib - Cmm code wrapper for the WinMessageBox function. This library
// ver.1 can be included in your source file to provide access to
// to the PM WinMessageBox() function. The PM MessageBox()
// function takes a parent window handle as the first parameter,
// but this wrapper simplifies it by automatically selecting
// DSKTOP as the parent window, which is OK for a modal function.
//
// FUNCTION: MessageBox()
// SYNTAX: MessageBox(MessageText[,BoxTitle[,TypeFlags]])
// MessageText: Text string to display in the message box.
// BoxTitle: Title to display on the box. If NULL or this parameter is
// not supplied then Windows defaults to the string "Error"
// TypeFlags: a number of flags, or'ed together to specify the behavior
// of the message box. If this parameter is not supplied then
// it defaults to MB_OK | MB_NOICON | MB_DEFBUTTON1 | MB_APPLMODAL.
// Possible OR'ed flags are:
// One of the following from the Button group:
#define MB_OK 0x0000 // 1 button: OK.
#define MB_OKCANCEL 0x0001 // 2 buttons OK and Cancel.
#define MB_RETRYCANCEL 0x0002 // 2 button: Retry and Cancel
#define MB_ABORTRETRYIGNORE 0x0003 // 3 butt: Abort, Retry, and Ignore
#define MB_YESNO 0x0004 // 2 button: Yes and No
#define MB_YESNOCANCEL 0x0005 // 3 button: Yes, No, and Cancel
#define MB_CANCEL 0x0006 // 1 button: Cancel
#define MB_ENTER 0x0007 // 1 button: Enter
#define MB_ENTERCANCEL 0x0008 // 2 button: Enter and Cancel
// Help button, not explicitly supported by CEnvi:
#define MB_HELP 0x2000
// One of the color or ICON group:
#define MB_NOICON 0x0000 // no icon
#define MB_ICONQUESTION 0x0010 // question mark icon
#define MB_WARNING 0x0020 // black '!' in square box
#define MB_ICONASTERISK 0x0030 // asterisk icon
#define MB_ERROR 0x0040 // STOP sign
// One of the following default actions
#define MB_DEFBUTTON1 0x0000
#define MB_DEFBUTTON2 0x0100
#define MB_DEFBUTTON3 0x0200
// One of the following MODALITY flags:
#define MB_APPLMODAL 0x0000 // CEnvi is disabled
#define MB_SYSTEMMODAL 0x1000 // system is disabled for this message
// Optional mobility flag
#define MB_MOVEABLE 0x4000 // message box may be moved
// RETURN: Returns one of these values:
#define MBID_OK 1 // OK pushbutton was selected
#define MBID_CANCEL 2 // CANCEL pushbutton was selected
#define MBID_ABORT 3 // ABORT pushbutton was selected
#define MBID_RETRY 4 // RETRY pushbutton was selected
#define MBID_IGNORE 5 // IGNORE pushbutton was selected
#define MBID_YES 6 // YES pushbutton was selected
#define MBID_NO 7 // NO pushbutton was selected
#define MBID_ENTER 9 // ENTER pushbutton was selected
#define MBID_ERROR 0xffff // Function not successful; an error occurred.
MessageBox(MessageText,BoxTitle,TypeFlags)
{
#define HWND_DESKTOP 1
#define ORD_WIN32MESSAGEBOX 789
// BoxTitle and TypeFlags are optional, and so check for their existence
// or else take defaults
return PMDynamicLink("PMWIN",ORD_WIN32MESSAGEBOX,BIT32,CDECL,
HWND_DESKTOP,PMInfo().WinHandle,MessageText,
va_arg() < 2 ? NULL : BoxTitle,
0,va_arg() < 3 ? MB_OK | MB_NOICON | MB_DEFBUTTON1 | MB_APPLMODAL : TypeFlags);
}