From 4bbfabfeb26d4fd1e9823f8bf4facf255e88324d Mon Sep 17 00:00:00 2001 From: Dario Sassi Date: Fri, 1 Jun 2018 10:57:49 +0000 Subject: [PATCH] EgtExecutor 1.9f1 : - aggiunta funzuine Lua EgtWinExec per lanciare l'esecuzione di un nuovo processo. --- EgtExecutor.rc | Bin 16146 -> 16146 bytes LUA_General.cpp | 34 ++++++++++++++++++++++++++++------ 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/EgtExecutor.rc b/EgtExecutor.rc index a56bcf896862f87cc77e06f1fc1a9ae8332bdfe1..cee952879624c85ed04d4f2d04ee1bfac1eb41d8 100644 GIT binary patch delta 103 zcmbPKH>qyJH#Sx?1|0^&&A-{4nVHjo3`efTEO4>oOp`YVR)EAOJ8~s&?h~?r$(qXMFs#pEgl&F delta 103 zcmbPKH>qyJH#SyN1|0^|&A-{4nVD083`efTEO4>oOp`YVR)EAOJ8~s&?h~?r$(qXMFs#t=^ilv 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 ; }