Hi, I am trying to find out how to fix my window size when I am in window mode, but it seems no way to implement such feature?
Just trace source code, find out that when I drag window from edge, this function will always be called which trigger by Windows Messages:
bool FSlateApplication::OnSizeChanged( const TSharedRef< FGenericWindow >& PlatformWindow, const int32 Width, const int32 Height, bool bWasMinimized )
Thanks for your help.
After two days of survey, finally find out the answer by calling windows api, here is my code:
#if PLATFORM_WINDOWS
#include "windows/WindowsWindow.h"
#include "SharedPointer.h"
#endif //PLATFORM_WINDOWS
#include "AllowWindowsPlatformTypes.h"
void AHopePlayerController::AdjustWindow() {
#if PLATFORM_WINDOWS
TSharedPtr<FGenericWindow> NativeWindow = GEngine->GameViewport->GetWindow()->GetNativeWindow();
auto Window = static_cast<FWindowsWindow*>(NativeWindow.Get());
//https://msdn.microsoft.com/en-us/library/windows/desktop/ms644898%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396
//https://msdn.microsoft.com/en-us/library/windows/desktop/ff700543(v=vs.85).aspx
//DWORD WindowStyle = WS_DLGFRAME;
DWORD WindowExStyle = WS_EX_APPWINDOW;
DWORD WindowStyle = WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION | WS_MAXIMIZEBOX | WS_MINIMIZEBOX
| WS_VISIBLE;
//| WS_THICKFRAME | WS_POPUP | WS_DLGFRAME | WS_VISIBLE;
auto hWnd = Window->GetHWnd();
SetWindowLongPtr(hWnd, GWL_EXSTYLE, (LONG_PTR)WindowExStyle);
SetWindowLongPtr(hWnd, GWL_STYLE, (LONG_PTR)WindowStyle);
#endif // #if PLATFORM_WINDOWS
}
#include "HideWindowsPlatformTypes.h"