EgtExecutor 2.5a3 :

- aggiunta funzione ExeMessageBox.
This commit is contained in:
DarioS
2023-01-17 11:29:59 +01:00
parent 553efdec1b
commit b1a11c4eaf
3 changed files with 41 additions and 11 deletions
+12
View File
@@ -536,6 +536,18 @@ ExeGetEnableUI( void)
return s_bEnableUI ;
}
//-----------------------------------------------------------------------------
int
ExeMessageBox( const string& sText, const string& sTitle, int nType)
{
int nRes = 0 ;
if ( ExeGetEnableUI()) {
HWND hTopWnd = ExeGetMainWindowHandle() ;
nRes = MessageBox( hTopWnd, stringtoW( sText), stringtoW( sTitle), nType | MB_TASKMODAL) ;
}
return nRes ;
}
//-----------------------------------------------------------------------------
bool
ExeSetProcessEvents( pfProcEvents pFun)
BIN
View File
Binary file not shown.
+29 -11
View File
@@ -493,7 +493,7 @@ LuaGetEnableUI( lua_State* L)
static int
LuaOutBox( lua_State* L)
{
// 2 o 3 parametri : stringa, titolo [, icona]
// 2, 3 o 4 parametri : sOut, sTitle [, sIcon] [, sButtons]
string sOut ;
LuaCheckParam( L, 1, sOut)
string sTitle ;
@@ -510,16 +510,34 @@ LuaOutBox( lua_State* L)
nIcon = MB_ICONINFORMATION ;
else if ( sIcon == "QUESTION")
nIcon = MB_ICONQUESTION ;
string sButtons ;
LuaGetParam( L, 4, sButtons) ;
int nButtons = MB_OKCANCEL ;
ToUpper( sButtons) ;
if ( sButtons == "OK")
nButtons = MB_OK ;
else if ( sButtons == "OKCANCEL")
nButtons = MB_OKCANCEL ;
else if ( sButtons == "ABORTRETRYIGNORE")
nButtons = MB_ABORTRETRYIGNORE ;
else if ( sButtons == "YESNOCANCEL")
nButtons = MB_YESNOCANCEL ;
else if ( sButtons == "YESNO")
nButtons = MB_YESNO ;
else if ( sButtons == "RETRYCANCEL")
nButtons = MB_RETRYCANCEL ;
else if ( sButtons == "CANCELTRYCONTINUE")
nButtons = MB_CANCELTRYCONTINUE ;
LuaClearStack( L) ;
// se abilitata UI, emetto la finestra di dialogo
int nRes = IDCANCEL ;
if ( ExeGetEnableUI()) {
HWND hTopWnd = ExeGetMainWindowHandle() ; // FindTopWindow() ;
nRes = MessageBox( hTopWnd, stringtoW( sOut), stringtoW( sTitle),
MB_OKCANCEL | nIcon | MB_TASKMODAL) ;
}
// risultato (Ok->true, Cancel->false)
LuaSetParam( L, ( nRes == IDOK)) ;
// emetto finestra di dialogo (solo se ablitata UI)
int nRes = ExeMessageBox( sOut, sTitle, nButtons | nIcon) ;
// risultato
if ( nRes == IDOK || nRes == IDRETRY || nRes == IDYES || nRes == IDTRYAGAIN)
LuaSetParam( L, true) ;
else if ( nRes == IDNO || nRes == IDCONTINUE || nRes == IDIGNORE)
LuaSetParam( L, false) ;
else
LuaSetParam( L) ;
return 1 ;
}
@@ -1150,7 +1168,7 @@ LuaDialogBox( lua_State* L)
// se abilitata UI, lancio dialogo
if ( ExeGetEnableUI()) {
// lancio dialogo
HWND hTopWnd = ExeGetMainWindowHandle() ; // FindTopWindow() ;
HWND hTopWnd = ExeGetMainWindowHandle() ;
bool bOk = ( DialogBox( GetModuleIstance(), MAKEINTRESOURCE( IDD_LUADLG), hTopWnd, (DLGPROC)DialogBoxProc) == IDOK) ;
// restituzione parametri
if ( bOk) {