Fix Window manager Siemens

This commit is contained in:
Nicola Carminati
2019-07-30 10:27:02 +02:00
parent fc56b0e4c9
commit ac20ecd8f1
+9 -4
View File
@@ -100,7 +100,10 @@ namespace Active_Client.View
private static int ActiveNCWindowStyle;
private static int ActiveNCWindowBorder;
private static int ActiveWindowNCWindowStyle;
private static int ActiveWindowNCWindowBorder;
private static int ActiveWindowNCWindowBorder;
private static uint ActiveWindowNCPopUp;
private static uint ActiveNCWindowNCPopUp;
public static MainForm mainFrm;
private static string prodEXEname;
@@ -645,7 +648,7 @@ namespace Active_Client.View
UnhookWinEvent(hhookWindow);
//Attach the OSAI hook
if (windowstarted && Config.VendorHmiConfig.Type == 3)
if (windowstarted && (Config.VendorHmiConfig.Type == 2 || Config.VendorHmiConfig.Type == 3))
{
procDelegateWindow = new WinEventDelegate(WinEventProcWindow);
hhookWindow = SetWinEventHook(EVENT_OBJECT_CREATE, EVENT_OBJECT_DESTROY, IntPtr.Zero, procDelegateWindow, 0, 0, WINEVENT_OUTOFCONTEXT);
@@ -987,9 +990,10 @@ namespace Active_Client.View
//Find if it has the border
ActiveWindowNCWindowBorder = (ActiveWindowNCWindowStyle & WS_BORDER);
ActiveWindowNCPopUp = ((uint)ActiveWindowNCWindowStyle & WS_POPUP);
//if it has the border and a title execute focus
if (ActiveWindowNCWindowStyle != 0 && ActiveWindowNCWindowBorder == WS_BORDER && ReadWindowTitle(hwnd) != "")
if (ActiveWindowNCWindowStyle != 0 && (((ActiveWindowNCWindowBorder == WS_BORDER) && ReadWindowTitle(hwnd) != "") || (ActiveWindowNCPopUp == WS_POPUP) ))
{
if (eventType == EVENT_OBJECT_CREATE)
{
@@ -1021,10 +1025,11 @@ namespace Active_Client.View
ActiveNCWindowStyle = GetWindowLong(hwnd, GWL_STYLE);
//Find if it has the border
ActiveNCWindowBorder = (ActiveNCWindowStyle & WS_BORDER);
ActiveNCWindowNCPopUp = ((uint)ActiveWindowNCWindowStyle & WS_POPUP);
//if it has the border and a title execute focus
if (ActiveNCWindowStyle != 0 && ActiveNCWindowBorder == WS_BORDER && ReadWindowTitle(hwnd) != "" && hwnd != ncprocess.MainWindowHandle)
if (ActiveNCWindowStyle != 0 && ((ActiveNCWindowBorder == WS_BORDER && ReadWindowTitle(hwnd) != "") || (ActiveNCWindowNCPopUp == WS_POPUP)) && hwnd != ncprocess.MainWindowHandle)
{
SetWindowPos(ncprocess.MainWindowHandle, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_SHOWWINDOW);
}