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);
}
发布了40 篇原创文章 · 获赞 14 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/zhangmei126/article/details/92794722