diff --git a/EgtExecutor.rc b/EgtExecutor.rc index a56bcf8..cee9528 100644 Binary files a/EgtExecutor.rc and b/EgtExecutor.rc differ diff --git a/LUA_General.cpp b/LUA_General.cpp index 4edf7ab..6624a93 100644 --- a/LUA_General.cpp +++ b/LUA_General.cpp @@ -272,26 +272,26 @@ LuaOutLog( lua_State* L) static int LuaOutBox( lua_State* L) { - // 3 o 4 parametri : stringa, titolo, icona [, bModal] + // 2 o 3 parametri : stringa, titolo [, icona] string sOut ; LuaCheckParam( L, 1, sOut) string sTitle ; LuaCheckParam( L, 2, sTitle) string sIcon ; - LuaCheckParam( L, 3, sIcon) - int nIcon = MB_ICONINFORMATION ; + LuaGetParam( L, 3, sIcon) ; + int nIcon = 0 ; ToUpper( sIcon) ; if ( sIcon == "ERROR") nIcon = MB_ICONERROR ; else if ( sIcon == "WARNING") nIcon = MB_ICONWARNING ; - bool bModal = true ; - LuaGetParam( L, 4, bModal) ; + else if ( sIcon == "INFO") + nIcon = MB_ICONINFORMATION ; LuaClearStack( L) ; // emetto la finestra di dialogo HWND hTopWnd = ExeGetMainWindowHandle() ; // FindTopWindow() ; int nRes = MessageBox( hTopWnd, stringtoW( sOut), stringtoW( sTitle), - MB_OKCANCEL | nIcon | ( bModal ? MB_TASKMODAL : MB_SYSTEMMODAL)) ; + MB_OKCANCEL | nIcon | MB_TASKMODAL) ; // risultato (Ok->true, Cancel->false) LuaSetParam( L, ( nRes == IDOK)) ; return 1 ; @@ -614,6 +614,26 @@ LuaGetLanguage( lua_State* L) return 1 ; } +//------------------------------------------------------------------------------- +static int +LuaWinExec( lua_State* L) +{ + // un solo parametro : CmdLine + string sCmdLine ; + LuaCheckParam( L, 1, sCmdLine) + LuaClearStack( L) ; + // mando in esecuzione la linea di comando + STARTUPINFO si ; + PROCESS_INFORMATION pi ; + ZeroMemory( &si, sizeof(si)) ; + si.cb = sizeof(si) ; + ZeroMemory( &pi, sizeof(pi)) ; + bool bOk = ( CreateProcess( NULL, stringtoW( sCmdLine), NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi) != FALSE) ; + // restituisco il risultato + LuaSetParam( L, bOk) ; + return 1 ; +} + //------------------------------------------------------------------------------- const int MAX_CTRLS = 6 ; static int s_nCtrls = 0 ; @@ -776,5 +796,7 @@ LuaInstallGeneral( LuaMgr& luaMgr) bOk = bOk && luaMgr.RegisterFunction( "EgtIs64bit", LuaIs64bit) ; bOk = bOk && luaMgr.RegisterFunction( "EgtGetLanguage", LuaGetLanguage) ; bOk = bOk && luaMgr.RegisterFunction( "EgtDialogBox", LuaDialogBox) ; + bOk = bOk && luaMgr.RegisterFunction( "EgtWinExec", LuaWinExec) ; + return bOk ; }