diff options
author | Danyil Bohdan <danyil.bohdan@gmail.com> | 2016-08-27 12:16:39 +0300 |
---|---|---|
committer | Steve Bennett <steveb@workware.net.au> | 2016-08-29 10:01:37 +1000 |
commit | 133f9f9edbf5c3ade3a01cec72bd197e97c4e3fe (patch) | |
tree | b3c3a91178a282939cc5a8e1c941a2f67c6a24ed | |
parent | 5dd45e7baf34854b588dd77553f000fd111d0ed0 (diff) | |
download | jimtcl-133f9f9edbf5c3ade3a01cec72bd197e97c4e3fe.zip jimtcl-133f9f9edbf5c3ade3a01cec72bd197e97c4e3fe.tar.gz jimtcl-133f9f9edbf5c3ade3a01cec72bd197e97c4e3fe.tar.bz2 |
jim-win32.c: Add command win32.MessageBox
-rw-r--r-- | jim-win32.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/jim-win32.c b/jim-win32.c index 3520875..1a6a3b6 100644 --- a/jim-win32.c +++ b/jim-win32.c @@ -473,6 +473,29 @@ Win32_FreeLibrary(Jim_Interp *interp, int objc, Jim_Obj * const *objv) return r; } +/* win32.MessageBox message title ?type? */ +static int +Win32_MessageBox(Jim_Interp *interp, int objc, Jim_Obj * const *objv) +{ + int r; + const char *message, *title; + long int type = 0; + + if (objc < 3 || objc > 4) { + Jim_WrongNumArgs(interp, 1, objv, "message title ?type?"); + return JIM_ERR; + } + message = Jim_String(objv[1]); + title = Jim_String(objv[2]); + if (objc == 4) { + if (Jim_GetLong(interp, objv[3], &type) != JIM_OK) + return JIM_ERR; + } + r = (int) MessageBoxA(NULL, message, title, (int)type); + Jim_SetResultInt(interp, r); + return JIM_OK; +} + /* ---------------------------------------------------------------------- */ @@ -505,6 +528,7 @@ Jim_win32Init(Jim_Interp *interp) CMD(GetModuleHandle); CMD(LoadLibrary); CMD(FreeLibrary); + CMD(MessageBox); return JIM_OK; } |