Hi all,
I am trying to add “borderless window” / “maximized fullscreen” to a list of graphical fullscreen options. I know that (on Windows) launching the exe with -popupwindow will give a borderless window and keep it correct while I change resolutions and configure other graphical settings. Rather than ask the players to relaunch the game every time they want to switch from a window with a border and a window without a border I want them to be able to change it in the in-game graphics menu.
I have resorted to using user32.dll functions to change the window properties like so;
var bounds = Screen.PrimaryScreen.Bounds;
SetWindowLong(GetForegroundWindow(), GWL_STYLE, 1);
bool result = SetWindowPos(GetForegroundWindow(), 0, 0, 0, bounds.Width, bounds.Height, SWP_SHOWWINDOW);
It seems to work but not very well (it doesn’t seem to work all the time and it doesn’t work after setting the window to other resolutions). It makes me wonder; is Unity3D aggressively setting the window style after I try to change it?
If so, is there any way to work around this or (much, much more prefferably) is there any way for me to access the properties set by launching with “-popupwindow”? (I’m crossing my fingers for a response from a Unity dev)
Currently this is quite a pain in the behind; for me as a developer and more importantly for players who will have to use the graphics settings. Any help would be appreciated, thanks!