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.
![alt text][1]
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?
[1]: /storage/temp/185317-upload-2021-8-26-15-24-4.png
↧