当前位置:网站首页>UE4 外部打开exe文件
UE4 外部打开exe文件
2022-07-25 09:26:00 【飞起的猪】
最近研究虚幻源码的时候看到一个问题,想尝试一下在外部打开打包后的exe文件,就找到了这两个函数
前期需要加入头文件
#include"Runtime/Core/Public/HAL/PlatformFilemanager.h"
#include"Runtime/Core/Public/Misc/FileHelper.h"
#include"Runtime/Core/Public/Misc/Paths.h"
#include "Windows/AllowWindowsPlatformTypes.h"
#include "Windows/PreWindowsApi.h"
#include <windows.h>
#include <string>
#include "Windows/PostWindowsApi.h"
#include "Windows/HideWindowsPlatformTypes.h"
#include <ShlDisp.h>
#include <shellapi.h>
一、UFUNCTION(BlueprintCallable)
void OpenExternalApp(const FString& AppPath);
.h文件
UFUNCTION(BlueprintCallable)
void OpenExternalApp(const FString& AppPath);
.cpp文件
void AMyGameMode::OpenExternalApp(const FString& AppPath)
{
pHandle = FPlatformProcess::CreateProc(*AppPath, nullptr, true, false, false, nullptr, 0, nullptr, nullptr);
UE_LOG(LogTemp, Warning, TEXT(__FUNCTION__"Create App"))
}二、UFUNCTION(BlueprintCallable)
void ExecuteExternalApp(const FString& AppPath);
.h文件
UFUNCTION(BlueprintCallable)
void ExecuteExternalApp(const FString& AppPath);
.cpp文件
void AMyGameMode::ExecuteExternalApp(const FString& AppPath)
{
std::string str_path = TCHAR_TO_UTF8(*AppPath);
std::wstring wstr_path;
wstr_path.assign(str_path.begin(), str_path.end());
ShellExecute(NULL, L"open", wstr_path.c_str(), NULL, NULL, SW_SHOWDEFAULT);
}三、蓝图操作
打开关卡蓝图,此处我是放在GamemMode里面写的

边栏推荐
- ~3 CCF 2022-03-2 travel plan
- js利用requestAnimationFrame实时检测当前动画的FPS帧率
- Qt 6.2的下载和安装
- MVC three-tier architecture understanding
- Mlx90640 infrared thermal imager temperature measurement module development notes (I)
- Record of deep learning segment error (segment core/ exit code 139)
- 字符串切片的用法
- Probability theory and mathematical statistics 3 discrete random variables and probability distributions (Part 2)
- 线程池的设计和原理
- pnpm简述
猜你喜欢

nodejs链接mysql报错:ER_NOT_SUPPORTED_AUTH_MODEError: ER_NOT_SUPPORTED_AUTH_MODE

@5-1 CCF 2019-12-1 reporting

小程序调起微信支付

安装 oh my zsh

Introduction to armv8 architecture

数据库MySQL详解

Fundamentals of C language

Qt 6.2的下载和安装
![[machine translation] scones -- machine translation with multi tag tasks](/img/72/d3e46a820796a48b458cd2d0a18f8f.png)
[machine translation] scones -- machine translation with multi tag tasks

看一个双非二本(0实习)大三学生如何拿到阿里、腾讯的offer
随机推荐
概率论与数理统计 4 Continuous Random Variables and Probability Distributions(连续随机变量与概率分布)(上篇)
VCs common commands
Common methods of nodejs version upgrade or switching
Subtotal of rospy odometry sinkhole
About student management system (registration, login, student side)
Qt 6.2的下载和安装
SSM整合(简单的图书管理系统来整合SSM)
Filter过滤器详解(监听器以及它们的应用)
js数字千位分割的常用方法
nodejs版本升级或切换的常用方式
Mlx90640 infrared thermal imaging sensor temperature measurement module development notes (III)
Wechat applet jumps to other applets
Probabilistic robot learning notes Chapter 2
salt常见问题
MVC三层架构理解
腾讯云之错误[100007] this env is not enable anonymous login
@Import,Conditional和@ImportResourse注解
Reflection 反射
CCF 201503-3 Festival
vscode插件开发