Download

Check process running crash game?!

Why this code part crashed game when try to use? (use win 10 OS,4.26+ ue)
.h


UFUNCTION(BlueprintCallable, Category = "exeFnc")
static bool runedExe(FString exeName);

.cpp


bool UMyBlueprintFunctionLibrary::runedExe(FString exeName)
{
const TCHAR* exeNameC= *exeName;
return FGenericPlatformProcess::IsApplicationRunning(exeNameC);
}

error when try to use:


---------------------------
The UE4-proverkaCpp Editor has crashed and will close
---------------------------
Fatal error: [File:D:/UE4/UnrealEngine-4.26/Engine/Source/Runtime/Core/Private/GenericPlatform/GenericPlatformProcess.cpp] [Line: 285]
FGenericPlatformProcess::IsApplicationRunning not implemented on this platform



---------------------------
ОК
---------------------------


want to check running mysql server to start or not him
check from pid chash too

hmmmm…
in engine source .cpp


bool FGenericPlatformProcess::IsApplicationRunning( uint32 ProcessId )
{
UE_LOG(LogHAL, Fatal, TEXT("FGenericPlatformProcess::IsApplicationRunning not implemented on this platform"));
return false;
}

bool FGenericPlatformProcess::IsApplicationRunning( const TCHAR* ProcName )
{
UE_LOG(LogHAL, Fatal, TEXT("FGenericPlatformProcess::IsApplicationRunning not implemented on this platform"));
return false;
}

ok.

FGenericPlatformProcess is “interface”[SUP]1[/SUP] class and shouldn’t be used directly. You should use FPlatformProcess.

Any platform define own class (ex. FWindowsPlatformProcess, FUnixPlatformProcess, etc.) that derive from FGenericPlatformProcess. Because FGenericPlatformProcess defines static methods(static cannot be virtual) then concrete platforms “override” them by shadowing. At the end of “*PlatformProcess.h” file you find typedef (for ex.typedef FWindowsPlatformProcess FPlatformProcess).

So:



bool IsRunning(FString const& AppName) const
{
    return FPlatformProcess::IsApplicationRunning(*AppName);
}


IsApplicationRunning is defined only for Windows/Unix/Mac platforms, so it works fine on that platforms, but calling it on Android fails.

1 - Not an interface known from OOP, more like a concept.

Thanks for answer, but i already solved this problem