diff --git a/Client/View/NcWindow.cs b/Client/View/NcWindow.cs index d29765f9..3a875bd0 100644 --- a/Client/View/NcWindow.cs +++ b/Client/View/NcWindow.cs @@ -1013,8 +1013,24 @@ namespace Active_Client.View if (NcProcessPID != 0 && ActualPID == NcProcessPID) { if (state == NcState.SHOW) - SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); + { + SetWindowPos(hwnd, ncprocess.MainWindowHandle, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_SHOWWINDOW); + } + + + //Read the style of the window + ActiveNCWindowStyle = GetWindowLong(hwnd, GWL_STYLE); + //Find if it has the border + ActiveNCWindowBorder = (ActiveNCWindowStyle & WS_BORDER); + + + //if it has the border and a title execute focus + if (ActiveNCWindowStyle != 0 && ActiveNCWindowBorder == WS_BORDER && ReadWindowTitle(hwnd) != "" && hwnd != ncprocess.MainWindowHandle) + { + SetWindowPos(ncprocess.MainWindowHandle, MainViewHandle, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_SHOWWINDOW); + } } + //If the PID is the STEP-HMI Process if (ActualPID == MainProcessPID)