当前位置:网站首页>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里面写的

边栏推荐
- Leetcode 560 前缀和+哈希表
- Record of deep learning segment error (segment core/ exit code 139)
- framework打包合并脚本
- dp-851
- 广度优先遍历(图和二叉树的层序遍历相关问题)
- Debug篇快捷键入门
- Probability theory and mathematical statistics 3 discrete random variables and probability distributions (Part 2)
- 严重 [main] org.apache.catalina.util.LifecycleBase.handleSubClassException 初始化组件
- JDBC操作数据库详解
- rospy Odometry天坑小计
猜你喜欢
随机推荐
Internal structure of SOC chip
CCF 201512-3 drawing
cookie and session
Common methods of JS digital thousand bit segmentation
用ESP32+TM1638实验NTP网络校时闹钟的ARDUINO代码
Yarn quick reference manual
ThreadLocal&Fork/Join
Armv8 datasheet learning
基础背包问题
Loam transformtoend function integrating IMU details
Debug篇快捷键入门
Coredata storage to do list
ROS distributed operation -- launch file starts nodes on multiple machines
第五阶段第一周
Filter过滤器详解(监听器以及它们的应用)
TM1637带秒点四位LED显示器模块ARDUINO驱动程序
力扣刷题组合问题总结(回溯)
Connection and data reading of hand-held vibrating wire vh501tc collector sensor
[necessary for growth] Why do I recommend you to write a blog? May you be what you want to be in years to come.
[RNN] analyze the RNN from rnn- (simple|lstm) to sequence generation, and then to seq2seq framework (encoder decoder, or seq2seq)









