Fix Osai Window Behaviour

This commit is contained in:
Nicola Carminati
2019-05-17 07:59:13 +02:00
parent 7be31c27aa
commit 1b377d0e36
+9 -10
View File
@@ -993,8 +993,8 @@ namespace Active_Client.View
{
if (eventType == EVENT_OBJECT_CREATE && state == NcState.SHOW)
SetForegroundWindow(ncprocess.MainWindowHandle);
else if(eventType == EVENT_OBJECT_DESTROY)
SetForegroundWindow(MainViewHandle);
else if (eventType == EVENT_OBJECT_DESTROY)
SetWindowPos(MainViewHandle, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_SHOWWINDOW);
}
}
@@ -1010,15 +1010,11 @@ namespace Active_Client.View
//Read the actual ID of the Process
GetWindowThreadProcessId(hwnd, out ActualPID);
Console.WriteLine(ReadWindowTitle(hwnd));
//Delete the TOPMOST Style of the Window
if (NcProcessPID != 0 && ActualPID == NcProcessPID)
{
if (state == NcState.SHOW)
{
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);
@@ -1029,7 +1025,8 @@ namespace Active_Client.View
//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);
SetWindowPos(hwnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE | SWP_SHOWWINDOW);
}
}
@@ -1055,8 +1052,8 @@ namespace Active_Client.View
if (Environment.OSVersion.Version.Major < 10)
HideTaskBar();
if (LastHookedPID != MainProcessPID && LastHookedPID != NcProcessPID && LastHookedPID != ProdProcessPID)
SetForegroundWindow(MainViewHandle);
//if (LastHookedPID != MainProcessPID && LastHookedPID != NcProcessPID && LastHookedPID != ProdProcessPID)
//SetForegroundWindow(MainViewHandle);
}
//If the PID is OTHER Process
@@ -1066,6 +1063,8 @@ namespace Active_Client.View
if (Environment.OSVersion.Version.Major < 10)
ShowTaskBar();
//SetForegroundWindow(hwnd);
//Hide Virtual keyboard
if (Config.ClientConfig.ShowVirtualKeyboard && Environment.OSVersion.Version.Major < 10 && KeyboardPID != 0 && ActualPID != KeyboardPID)
closeVirtualKeyboard();