How to open external application?

Hi there,

I tried a few hours to open an external application from Unreal. As there is no blueprint node for that, I had to create a C++ function library.

But I have really a hard time with C++ and Visual Studio.

This is my header file:

#pragma once

#include "Kismet/BlueprintFunctionLibrary.h"
#include "VRSR_CPP_FL.generated.h"


/**
 * 
 */
UCLASS()
class VRSHOWROOM_API UVRSR_CPP_FL : public UBlueprintFunctionLibrary
{
	GENERATED_UCLASS_BODY()
	
	UFUNCTION(BlueprintCallable, Category = "VRShowRoom")
	static void connectWiiMote();
	
	
};

My CPP file:

// #include "Windows/WindowsSystemIncludes.h" //ERROR, SO USING WINDOWS.H INSTEAD
#include <windows.h>> 

#include "VRShowRoom.h"
#include "VRSR_CPP_FL.h"
   
////Our function lib
UVRSR_CPP_FL::UVRSR_CPP_FL(const class FObjectInitializer& PCIP)
	: Super(PCIP)
{
}

//Connect to WiiMote	
void UVRSR_CPP_FL::connectWiiMote()
	{
		
	ClientMessage("Connecting Wiimote..."); //ERROR
	
	ShellExecute(NULL, "open", "path/to/connectWiiMote.exe", NULL, NULL, SW_HIDE); //ERROR

	};

I just can’t get VS to compile this. Seems that the #include doesn’t work, Shellexecute isn’t even found.

So is there any method of just running an exe from within UE4 without getting crazy? Many thanks. :wink: