Hi!
I’m trying to set viewport size with C++ by Windows API.
My code only works in Editor.
What should I do to make it works after packaging ?
here is my code
#if PLATFORM_WINDOWS
#include "windows/WindowsWindow.h"
#include "Windows/AllowWindowsPlatformTypes.h"
#endif
#if PLATFORM_WINDOWS
uint SWP_SHOWWINDOW = 0x0040;
TSharedPtr<FGenericWindow> NativeWindow = GEngine->GameViewport->GetWindow()->GetNativeWindow();
auto Window = static_cast<FWindowsWindow*>(NativeWindow.Get());
auto hWnd = Window->GetHWnd();
SetWindowPos(hWnd, 0, x, y, width, height, SWP_SHOWWINDOW );
#endif
I also tried
GEngine->GameViewport->GetWindow()->ReshapeWindow(FVector2D(x, y), FVector2D(width, height));
it doesn’t work, either.
Thanks for your help.