Constrain resizing of the window in windowed mode?

I have not been able to figure out how can I constrain the resizing of the window in windowed mode.
For example I don’t want players to be able to drag the corner of the window and make it smaller than 1024x768.

I don’t find anything online telling me how I can do this, so is this somehow possible ?

cheers

I don’t believe you can accomplish this with blueprints but if you’re using the engine source code in your project you can go to GameEngine.cpp and find the function UGameEngine::CreateGameWindow()

where it says:

TSharedRef Window = SNew(SWindow)
.ClientSize(FVector2D( ResX, ResY ))
.Title(WindowTitle)
.AutoCenter(AutoCenterType)
.ScreenPosition(FVector2D(WinX, WinY))
.FocusWhenFirstShown(true)
.SaneWindowPlacement(AutoCenterType == EAutoCenter::None)
.UseOSWindowBorder(true);

Add a line to the bottom:

 .SizingRule(ESizingRule::FixedSize);

So the entire blob reads:

TSharedRef Window = SNew(SWindow)
.ClientSize(FVector2D( ResX, ResY ))
.Title(WindowTitle)
.AutoCenter(AutoCenterType)
.ScreenPosition(FVector2D(WinX, WinY))
.FocusWhenFirstShown(true)
.SaneWindowPlacement(AutoCenterType == EAutoCenter::None)
.UseOSWindowBorder(true)
.SizingRule(ESizingRule::FixedSize);

Cheers

Hi and thanks for the answer.

The comment for ESizingRule::FixedSize says “The windows size fixed and cannot be resized”.
By reading that it looks like I can’t change the window size at all after creation? I want players to be able to change the size of the window, but just not make it smaller than X.

…and now I went looking at the SWindow class ( SWindow | Unreal Engine Documentation ) and I see there is SizeLimits which then has SetMinWidth/SetMinHeight… sounds like that is what I want. I just can’t test it now since I don’t have the engine source in my project (will add later if needed)…
My project is a C++ project, do you know if there is any way to get a hook to the game window from C without adding the engine code to the project?

Thanks again

I don’t know of any clever hooks that wouldn’t require engine code, sorry. but I can say with FixedSize I can still resize the window programmatically at runtime in my project, I just can’t click to drag resize.

I think you can subclass the UE4 window and then handle the command WM_GETMINMAXINFO to achieve the effect that you wanted.