Changing the position and size of my game window doesn't always work

Hi,

I need to change the size and position of my game window. It must work with 1 monitor or 3 monitors (extended under MS Windows).
For my test i have a PC with 2 monitors of 1920x1080. The MS Windows desktop is extended.

I have tried to use UGameUserSettings. When i tried different game window size and game window positions, sometimes it works, sometimes it doesn’t work (bad position, bad window size).
And i can never have a game window width bigger then 1920.

UGameUserSettings* settings = GEngine->GameUserSettings;
settings->SetScreenResolution(resolution);
settings->SetWindowPosition(position.X, position.Y);
settings->SetFullscreenMode(EWindowMode::Type::Windowed);
settings->SetResolutionScaleValueEx(100);
settings->ConfirmVideoMode();
settings->ApplyResolutionSettings(true);

I have also tried to launche this command during the game:

r.setres 2520x1080w

It changes the size of the window with succes. The width and height is good but it ignores previous window Position (x and y are set to zero)

In C++, this function do the same job and same result:

FSystemResolution::RequestResolutionChange(widthX, heightY, EWindowMode::Windowed);

How can i change the position and the size of my game window on a PC having one or more monitors ?

You are probably missing the monitor from the calls / there has to be an override in the C++ functions to define what monitor your X and Y are relative to.

If not, then the position of the window would be in units relative to the overall resolution of your setup

Either way the engine doesnt even allow you to set vsync on and off without jumping through hoops, so i doubt youll find a simple solution to this that doesnt involve runtime code/hacks of the sort.

And generally speaking window management is up to the OS, so a program doesn’t usually move windows around. The user does.
Its very possible you work on this a bunch and tomorrow a windows update comes in that stops it from working…

Resolution setting wise, that usually requires writkng to the .ini file and restarting the game. Like vsync.