EgtExecutor 1.8b6 :
- aggiunta impostazione handle finestra principale dell'exe per dialoghi della dll.
This commit is contained in:
@@ -16,6 +16,9 @@
|
||||
#include "GseContext.h"
|
||||
#include "/EgtDev/Include/EgtILogger.h"
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
HWND ExeGetMainWindowHandle( void) ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
const std::string& ExeGetIniFile( void) ;
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ static int s_nKeyType = KEY_LOCK_TYPE_ANY ;
|
||||
static string s_sIniFile ;
|
||||
static pfProcEvents s_pFunProcEvents = nullptr ;
|
||||
static pfOutText s_pFunOutText = nullptr ;
|
||||
static HWND s_hMainWnd = nullptr ;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
@@ -427,6 +428,22 @@ ExeOutText( const string& sText)
|
||||
return false ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
bool
|
||||
ExeSetMainWindowHandle( HWND hMainWnd)
|
||||
{
|
||||
s_hMainWnd = hMainWnd ;
|
||||
return true ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
HWND
|
||||
ExeGetMainWindowHandle( void)
|
||||
{
|
||||
return s_hMainWnd ;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------
|
||||
const string&
|
||||
|
||||
Binary file not shown.
+3
-2
@@ -27,14 +27,15 @@ FindTopWindow( void)
|
||||
pair<HWND, DWORD> params = { 0, pid} ;
|
||||
|
||||
// Enumerate the windows using a lambda to process each window
|
||||
SetLastError( 0) ;
|
||||
BOOL bResult = EnumWindows( []( HWND hWnd, LPARAM lParam) -> BOOL
|
||||
{
|
||||
auto pParams = ( pair<HWND, DWORD>*)(lParam) ;
|
||||
|
||||
DWORD processId ;
|
||||
if ( GetWindowThreadProcessId( hWnd, &processId) &&
|
||||
if ( GetWindowThreadProcessId( hWnd, &processId) != NULL &&
|
||||
processId == pParams->second &&
|
||||
GetWindow( hWnd, GW_OWNER) == (HWND) nullptr &&
|
||||
GetWindow( hWnd, GW_OWNER) == NULL &&
|
||||
IsWindowVisible( hWnd)) {
|
||||
// Stop enumerating
|
||||
SetLastError( -1) ;
|
||||
|
||||
+5
-3
@@ -242,7 +242,8 @@ LuaOutBox( lua_State* L)
|
||||
LuaGetParam( L, 4, bModal) ;
|
||||
LuaClearStack( L) ;
|
||||
// emetto la finestra di dialogo
|
||||
int nRes = MessageBox( FindTopWindow(), stringtoW( sOut), stringtoW( sTitle),
|
||||
HWND hTopWnd = ExeGetMainWindowHandle() ; // FindTopWindow() ;
|
||||
int nRes = MessageBox( hTopWnd, stringtoW( sOut), stringtoW( sTitle),
|
||||
MB_OKCANCEL | nIcon | ( bModal ? MB_TASKMODAL : MB_SYSTEMMODAL)) ;
|
||||
// risultato (Ok->true, Cancel->false)
|
||||
LuaSetParam( L, ( nRes == IDOK)) ;
|
||||
@@ -304,7 +305,7 @@ LuaFileDialog( lua_State* L)
|
||||
OPENFILENAME ofn ;
|
||||
ZeroMemory( &ofn, sizeof( ofn)) ;
|
||||
ofn.lStructSize = sizeof( ofn) ;
|
||||
ofn.hwndOwner = FindTopWindow() ;
|
||||
ofn.hwndOwner = ExeGetMainWindowHandle() ; // FindTopWindow() ;
|
||||
ofn.lpstrFilter = LPWSTR( wsFilter) ;
|
||||
ofn.lpstrFile = LPWSTR( wsFileName) ;
|
||||
ofn.nMaxFile = MAX_PATH ;
|
||||
@@ -622,7 +623,8 @@ LuaDialogBox( lua_State* L)
|
||||
}
|
||||
LuaClearStack( L) ;
|
||||
// lancio dialogo
|
||||
bool bOk = ( DialogBox( GetModuleIstance(), MAKEINTRESOURCE( IDD_LUADLG), FindTopWindow(), (DLGPROC)DialogBoxProc) == IDOK) ;
|
||||
HWND hTopWnd = ExeGetMainWindowHandle() ; // FindTopWindow() ;
|
||||
bool bOk = ( DialogBox( GetModuleIstance(), MAKEINTRESOURCE( IDD_LUADLG), hTopWnd, (DLGPROC)DialogBoxProc) == IDOK) ;
|
||||
// restituzione parametri
|
||||
if ( bOk) {
|
||||
STRVECTOR vRes ;
|
||||
|
||||
Reference in New Issue
Block a user