From 133f9f9edbf5c3ade3a01cec72bd197e97c4e3fe Mon Sep 17 00:00:00 2001 From: Danyil Bohdan Date: Sat, 27 Aug 2016 12:16:39 +0300 Subject: [PATCH] jim-win32.c: Add command win32.MessageBox --- jim-win32.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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; } -- 2.11.4.GIT