EgtExecutor 1.6x5 :
- migliorata in Lua EgtOutBox - aggiunta in Lua EgtFileDialog - aggiunta in Lua EgtGetCalcToolDirFromaAngles.
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
//----------------------------------------------------------------------------
|
||||
// EgalTech 2017-2017
|
||||
//----------------------------------------------------------------------------
|
||||
// File : GenTools.cpp Data : 08.01.17 Versione : 1.6x5
|
||||
// Contenuto : Funzioni generalie.
|
||||
//
|
||||
//
|
||||
//
|
||||
// Modifiche : 08.01.17 DS Creazione modulo.
|
||||
//
|
||||
//
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "GenTools.h"
|
||||
#include <utility>
|
||||
|
||||
using namespace std ;
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
HWND
|
||||
FindTopWindow( void)
|
||||
{
|
||||
// Recupero l'Id del processo corrente
|
||||
DWORD pid = GetCurrentProcessId() ;
|
||||
|
||||
pair<HWND, DWORD> params = { 0, pid} ;
|
||||
|
||||
// Enumerate the windows using a lambda to process each window
|
||||
BOOL bResult = EnumWindows( []( HWND hWnd, LPARAM lParam) -> BOOL
|
||||
{
|
||||
auto pParams = ( pair<HWND, DWORD>*)(lParam) ;
|
||||
|
||||
DWORD processId ;
|
||||
if ( GetWindowThreadProcessId( hWnd, &processId) &&
|
||||
processId == pParams->second &&
|
||||
GetWindow( hWnd, GW_OWNER) == (HWND) nullptr &&
|
||||
IsWindowVisible( hWnd)) {
|
||||
// Stop enumerating
|
||||
SetLastError( -1) ;
|
||||
pParams->first = hWnd ;
|
||||
return FALSE ;
|
||||
}
|
||||
|
||||
// Continue enumerating
|
||||
return TRUE ;
|
||||
}, (LPARAM) ¶ms) ;
|
||||
|
||||
|
||||
if ( ! bResult && GetLastError() == -1 && params.first != nullptr) {
|
||||
return params.first ;
|
||||
}
|
||||
|
||||
return nullptr ;
|
||||
}
|
||||
Reference in New Issue
Block a user