UE4+Window运行窗体操作

1、修改UE4运行窗口名字:(需要添加Slate,SlateCore模块)

if (GEngine && GEngine->GameViewport)
{
    FVector2D WindowPosition = position;

    GEngine->GameViewport->GetWindow()->SetTitle(FText::FromString(TEXT("1111")));
}

2、获取屏幕尺寸

const FVector2D ViewportSize = FVector2D(GEngine->GameViewport->Viewport->GetSizeXY())

3、使窗口可拖拽文件

#include "AllowWindowsPlatformTypes.h"

#include "shellapi.h"

#include "HideWindowsPlatformTypes.h"


HWND hwndd = GetActiveWindow();

DragAcceptFiles(hwndd, true);

4、移动Windows游戏窗口

if (GEngine && GEngine->GameViewport)
{
    FVector2D WindowPosition = position;

    GEngine->GameViewport->GetWindow()->MoveWindowTo(WindowPosition);
}

 

你可能感兴趣的:(UE4,C++)