How to set window position and border

I try to spawn a window across 4 monitors. For this i want to change the window position and turn off its border.
However, even when window is smaller than single monitor, the WindowPosX and WindowPosY of the GameUserSettings.ini do nothing.
I also tried command arguments as described here:
https://docs.unrealengine.com/latest/INT/Programming/Basics/CommandLineArguments/index.html
They dont work either, or i dont know how to use them properly.

Changing game window position through GameUserSettings->SetWindowPosition didn’t work me either. Fortunately, I’ve found solution. (Thanks Epic for access to your source code!! <3)

So, here’s what I’ve done:

Uncommented this line in file GAMENAME.Build.cs

PrivateDependencyModuleNames.AddRange(new string[] { "Slate", "SlateCore" });

And then, I used, this (you can use this basically everywhere):

if (GEngine && GEngine->GameViewport)
{
    FVector2D WindowPosition = FVector2D(0.f, 0.f);
    GEngine->GameViewport->GetWindow()->MoveWindowTo(WindowPosition);
}

Ofc, you’ll have to calculate WindowPosition on your own, but I’m sure you’ll be able to do so easily. :stuck_out_tongue:

Tested on UE4.7.3 DebugGame Editor build.

Edit:

I just tested if it’s possible to set game window between 2 monitors and it works properly.

So, in scenario where you’d have 4 screens and each of them would be full HD and your primary screen would be 1st from the right you’d have to use WindowPosition with X value == (-1) * 3 * 1920. and Y == 0

Hope it helps. :stuck_out_tongue:

1 Like

Where do I find the GAMENAME.Build.cs

Read here: [ [BuildTools][2] ]

And to find the [YourProjectName].Build.cs file: (or in the example above GAMENAME.Build.cs)

  • if you have been using a Blueprint project so far, you need to create a new C++ class, then the engine will open the preferred editor for you. (I am using VS 2017)

  • if you are using C++ project, then open the Solution file (.sln). Can be found in the same folder, where your project sits.

Check the attached picture to see where to find the .cs file, once you have opened your preferred IDE.

Hope that helps!

Hey Guys,
So the code above works for me only in Editor. If I play standalone, launch it or package it it crashes.

Edit: I found this plugin which works: Viewport Extension in Code Plugins - UE Marketplace