2 * MSGBOX.C - msgbox internal command.
4 * clone from 4nt msgbox command
7 * started - Paolo Pantaleo <paolopan@freemail.it>
9 * 30-Apr-2005 (Magnus Olsen <magnus@greatlord.com>)
10 * Remove all hardcoded strings in En.rc
15 #ifdef INCLUDE_CMD_MSGBOX
20 //undefine it to allow to omit arguments
21 //that will be replaced by default ones
25 INT
CommandMsgbox (LPTSTR param
)
27 //used to parse command line
30 //used to find window title (used as messagebox title)
31 //and to find window handle to pass to MessageBox
35 //these are MessabeBox() parameters
36 LPTSTR title
, prompt
= "";
37 UINT uType
= U_TYPE_INIT
;
39 /* set default title to window title */
40 GetConsoleTitle(buff
, 128);
43 if (_tcsncmp (param
, _T("/?"), 2) == 0)
45 ConOutResPaging(TRUE
,STRING_MSGBOX_HELP
);
49 //yes here things are quite massed up :)
52 while(_istspace(*param
))
55 //search for type of messagebox (ok, okcancel, ...)
56 if (_tcsnicmp(param
, _T("ok "), 3) == 0)
58 uType
|= MB_ICONEXCLAMATION
| MB_OK
;
61 else if (_tcsnicmp(param
, _T("okcancel "), 9) == 0)
63 uType
|= MB_ICONQUESTION
| MB_OKCANCEL
;
66 else if (_tcsnicmp(param
, _T("yesno "), 6) == 0)
68 uType
|= MB_ICONQUESTION
| MB_YESNO
;
71 else if (_tcsnicmp(param
, _T("yesnocancel "), 12) == 0)
73 uType
|= MB_ICONQUESTION
| MB_YESNOCANCEL
;
79 error_req_param_missing ();
82 uType
|= MB_ICONEXCLAMATION
| MB_OK
;
87 while(_istspace(*param
))
91 //if reached end of string
92 //it is an error becuase we do not yet have prompt
95 error_req_param_missing ();
105 tmp
= _tcschr(param
+ 1, '"');
116 while(_istspace(*param
))
123 error_req_param_missing ();
130 hWnd
=GetConsoleWindow ();
132 switch (MessageBox(hWnd
, prompt
, title
, uType
))
151 #endif /* INCLUDE_CMD_MSGBOX */