当前位置: 首页 > news >正文

徐汇网站开发建大型网站

徐汇网站开发,建大型网站,湛江的高铁站建在哪里,桂林官网UE5 运行时捕捉外部窗口并嵌入到主窗口的一种方法 创建一个Slate类用于生成一个窗口 .h// Fill out your copyright notice in the Description page of Project Settings.#pragma once#include "CoreMinimal.h" #include "Widgets/SCompoundWidget.h"/*…

UE5 运行时捕捉外部窗口并嵌入到主窗口的一种方法

创建一个Slate类用于生成一个窗口

.h// Fill out your copyright notice in the Description page of Project Settings.#pragma once#include "CoreMinimal.h"
#include "Widgets/SCompoundWidget.h"/*** */
class NEWWINDOWTEST0822_API SCreateNewWindow : public SCompoundWidget
{
public:SLATE_BEGIN_ARGS(SCreateNewWindow){}SLATE_END_ARGS()/** Constructs this widget with InArgs */void Construct(const FArguments& InArgs);static void CreateAAA();
};
.cpp// Fill out your copyright notice in the Description page of Project Settings.#include "SCreateNewWindow.h"
#include "SlateOptMacros.h"BEGIN_SLATE_FUNCTION_BUILD_OPTIMIZATION
void SCreateNewWindow::Construct(const FArguments& InArgs)
{/*ChildSlot[// Populate the widget];*/
}void SCreateNewWindow::CreateAAA()
{TSharedPtr<SWindow> NewWin = SNew(SWindow).ClientSize(FVector2D(800,600)).Title(FText::FromString(TEXT("AAAAA")));FSlateApplication::Get().AddWindow(NewWin.ToSharedRef());
}END_SLATE_FUNCTION_BUILD_OPTIMIZATION

创建一个Actor类,用于调用Slate类中的方法

.h// Fill out your copyright notice in the Description page of Project Settings.#pragma once#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "MyActor.generated.h"UCLASS()
class NEWWINDOWTEST0822_API AMyActor : public AActor
{GENERATED_BODY()public:	// Sets default values for this actor's propertiesAMyActor();protected:// Called when the game starts or when spawnedvirtual void BeginPlay() override;public:	// Called every framevirtual void Tick(float DeltaTime) override;UFUNCTION(BlueprintCallable,Category = "Function")static void SpawnWindow();UFUNCTION(BlueprintCallable,Category = "Function")static void findAAA(FString AAAname);static void OnMainWindowClosed();};
.cpp// Fill out your copyright notice in the Description page of Project Settings.#include "MyActor.h"
#include "Windows/AllowWindowsPlatformTypes.h"
#include "SCreateNewWindow.h"FDelegateHandle MainWindowClosedHandle; // 用于存储主窗口关闭事件的句柄
HWND OtherWindowHandle = nullptr; // 嵌入的子窗口句柄
// Sets default values
AMyActor::AMyActor()
{// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.PrimaryActorTick.bCanEverTick = true;}// Called when the game starts or when spawned
void AMyActor::BeginPlay()
{Super::BeginPlay();}// Called every frame
void AMyActor::Tick(float DeltaTime)
{Super::Tick(DeltaTime);}void AMyActor::SpawnWindow()
{SCreateNewWindow::CreateAAA();
}void AMyActor::findAAA(FString AAAname)
{void* winhandle = GEngine->GameViewport->GetWindow()->GetNativeWindow()->GetOSWindowHandle();//static_cast 一个类型转换运算符,用于进行静态类型转换。它可以用来将一个数据类型转换为另一个数据类型HWND MainWindowHwnd = static_cast<HWND>(winhandle);if (MainWindowHwnd){const WCHAR* WindowName = *AAAname;HWND otherWindow = FindWindowW(NULL, WindowName);SetWindowPos(otherWindow, NULL, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER);LONG style = GetWindowLong(otherWindow, GWL_STYLE);SetWindowLong(otherWindow, GWL_STYLE, style | WS_OVERLAPPEDWINDOW);SetParent(otherWindow,MainWindowHwnd);OtherWindowHandle = otherWindow;// 存储嵌入的子窗口句柄OtherWindowHandle = otherWindow;// 注册主窗口关闭事件//MainWindowClosedHandle = FCoreDelegates::OnPreExit.AddUObject(this, &AMyActor::OnMainWindowClosed);MainWindowClosedHandle = FCoreDelegates::OnPreExit.AddStatic(&AMyActor::OnMainWindowClosed);}}void AMyActor::OnMainWindowClosed()
{if (OtherWindowHandle){DestroyWindow(OtherWindowHandle);}// 取消主窗口关闭事件的注册FCoreDelegates::OnPreExit.Remove(MainWindowClosedHandle);
}

http://www.yayakq.cn/news/303716/

相关文章:

  • 网站建设朋友圈广告语网站免费搭建
  • 作图网站c2c十大平台
  • 天商阳光网站邮箱龙岗网络科技有限公司
  • 软件开发专业的大学网站建设和关键词优化技巧
  • 松岗做网站费用用html做一个网页
  • 网站制作电话wordpress 缓存文件
  • 组建 网站开发团队wordpress验证邮箱验证
  • 重庆欧勒精细陶瓷有限公司网站策划书手机怎么创建自己的网页
  • 佛山网站建设业务员最好的网站建设系统
  • 保定网站优化公司北京网站建设seo优化
  • 相亲网站建设关键重庆网站建设制作费用
  • 临汾网站建设价格技术共享平台
  • 做网站需要的服务器展示营销类网站
  • 南昌专业的电商网站开发公司营销网站设计包括
  • o2o网站建设平台一个网站多久能做完
  • 网站建设怎么做?网站备案需要准备什么材料
  • 网站改版技术要求游戏怎么开发制作
  • 闽清网站建设石家庄新闻头条新闻
  • 团购网站单页模板手机如何制作游戏
  • 专门做蛋糕面包的网站seo指导
  • 动漫网站设计与实现电子商务html网站模板
  • 保定网站优化公司网站建设搭建环境
  • 网站正在维护中html公众号图片wordpress
  • 10黄页网站建设如何做服装的微商城网站
  • 12.12做网站的标题微网站功能列表
  • 网站优化推广软件wordpress 免费 主题
  • 网站建设欣阿里云主机搭建网站
  • 唐山做网站那家好网站建设有哪些步骤
  • 如何制作和设计公司网站域名注册了 如何做网站
  • dw网页制作教程个人网站中石化石油工程建设公司网站