//.h文件
UCLASS()
class HLBPATROL_API UMyGameInstance : public UGameInstance
{
GENERATED_BODY()
public:
UFUNCTION(BlueprintCallable, Category = "MyWeb", meta = (Tooltip = "和web配置程序打交道"))
static void ExecMyWeb(FString Path, FString ExeName, FString Parms, bool bLaunchDetached,bool bLaunchHidden, bool bLaunchReallyHidden);
};
//.cpp文件
#include "MyGameInstance.h"
void UMyGameInstance::ExecMyWeb(FString Path,FString ExeName,FString Parms, bool bLaunchDetached, bool bLaunchHidden,bool bLaunchReallyHidden)
{
FString FilePath = Path + ExeName;
FProcHandle s = FPlatformProcess::CreateProc(*FilePath, *Parms, bLaunchDetached, bLaunchHidden, bLaunchReallyHidden, nullptr, -1, nullptr, nullptr);
FWindowsPlatformProcess::WaitForProc(s); //让新打开的应用串口阻塞程序 类似模态
}
参考文件:
https://www.jianshu.com/p/a804883a2c6b