Hi, how can I lock mouse to viewport?

Hi, how can I lock mouse to viewport, to prevent it leaving window out in editor and standalone mode?
I tried blueprints, checked editor options and mouse Interface in controller, overrided SetupInputComponent of my controller,
but mouse behaves it as I want only while it wasn’t clicked.

I found lot of threads about, but neither brings me to the decision.
Some mentioned FSceneViewport, but I didn’t figure out how to use it.
Here is controllers function:


void SetupInputComponent() override
{
	FInputModeGameAndUI mode;
	mode.SetLockMouseToViewport(true);
	SetInputMode(mode);
	Super::SetupInputComponent();		
}

Visual Studio didn’t find defenition of SetInputMode, how should it be implemented?