How do I close display window?
Hello, I want two display on my two screens, but not always. But, the Display API only has Activate function, and display activate function hide the title bar although it is window state(not full screen) I cannot close that to recover my game to origin state.
I try to close that with tool bar but it close all of them.
And I refer to the link https://forum.unity.com/threads/solved-how-to-remove-the-title-bar-of-a-game.729437/ to show title bar in update function (start function and onDisplayUpdated is not work) the result is only title bar but no button display.
there is my code
private void Awake()
{
hWnd = GetActiveWindow();
Display.onDisplaysUpdated += Display_onDisplaysUpdated;
}
public void DisplayActivate()
{
style = GetWindowLong(hWnd, GWL_STYLE).ToInt32();
Screen.SetResolution(1600, 900, false);
if (Display.displays.Length > 1)
{
Display.displays[1].Activate();
Display.displays[1].SetParams(1600, 900, 160, 90);
}
Screen.fullScreen = false;
}
private void Display_onDisplaysUpdated()
{
//SetWindowLong(hWnd, GWL_STYLE, (uint)(style | WS_CAPTION | WS_SIZEBOX));
//SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
}
void Update()
{
SetWindowLong(hWnd, GWL_STYLE, (uint)(style | WS_CAPTION | WS_SIZEBOX));
SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
}
How do I pop the window and close when I want?
Your answer
Follow this Question
Related Questions
Working with multiple windows on the same scene unity 0 Answers
How do you make a script to close out this pop up menu? 1 Answer
Check When Game Window is Closed for Windows 0 Answers
using networking to create a Splitscreen game on 1 PC ? 0 Answers
Multiple windows?,Multiple Cameras, Canvases or Pop UPs? 0 Answers