UE4打开外部exe

.h

// Fill out your copyright notice in the Description page of Project Settings.

#pragma once

#include "CoreMinimal.h"
#include "Kismet/BlueprintFunctionLibrary.h"
#include "CommonBlueprintFunctionLibrary.generated.h"

/**
 * 
 */
UCLASS()
class CESIUMPROTEST_API UCommonBlueprintFunctionLibrary : public UBlueprintFunctionLibrary
{
	GENERATED_BODY()

public:
	UFUNCTION(BlueprintCallable, Category = ExcExe)
		static bool OpenExe(FString URL);
	
};

.cpp

// Fill out your copyright notice in the Description page of Project Settings.


#include "CommonBlueprintFunctionLibrary.h"
#include"../Runtime/Core/Public/GenericPlatform/GenericPlatformProcess.h"

bool UCommonBlueprintFunctionLibrary::OpenExe(FString URL) {

	FProcHandle currHandle = FPlatformProcess::CreateProc(*URL, nullptr, true, false, false, nullptr, 0, nullptr, nullptr);
	UE_LOG(LogTemp, Warning, TEXT("URL:::%s"), *URL);
	return true;
}

猜你喜欢

转载自blog.csdn.net/yushengqi12345/article/details/128728494