Any way to replace default game window with the Slate window?

There’re some articles about how to add Slate windows, but I couldn’t find ones about how to make a single slate window replacing the default game viewport. I tried it for a day and ended up with something like:

TSharedRef<STextBlock> widget = (SNew(STextBlock).Text(LOCTEXT("Hello", "Hello")));
TSharedPtr<SWindow> window = GEngine->GameViewport->GetWindow();
window->SetContent(widget);

However, this method seems to be really unstable, usually crashes and shows error messages that don’t make sense.

Anyone can help me?