打开一个windows对话框
例子:
FailureMessage = FText::Format( LOCTEXT("PrimaryGameModuleCouldntBeLoaded", "The game module '{0}' could not be loaded. There may be an operating system error or the module may not be properly set up."), TextModuleName );
调用单例:
FMessageDialog::Open(EAppMsgType::Ok, FailureMessage);
有多种消息类型:
namespace EAppMsgType
{
/**
* Enumerates supported message dialog button types.
*/
enum Type
{
Ok,
YesNo,
OkCancel,
YesNoCancel,
CancelRetryContinue,
YesNoYesAllNoAll,
YesNoYesAllNoAllCancel,
YesNoYesAll,
};
}
运行本地的文件
FString ExePath =”E:\xxx.exe”;
if (ExePath != TEXT(""))
{
FProcHandle ProcHandle =
FPlatformProcess::CreateProc
(*ExePath, nullptr, true, false, false, 0, 0, nullptr, nullptr);
}
打开系统的文件操作对话框
IDesktopPlatform* DesktopPlatform = FDesktopPlatformModule::Get();
例子:
TArray<FString> OpenFilenames; /打开的文件名(绝对路径)
FString ExtensionStr; //设定的文件类型
if (EUploadMode::UploadFastMode == CurrrentUploadMode)
{
ExtensionStr = TEXT("FBX,JPG,BMP,PNG files|*.fbx;*.jpg;*.png;*.bmp");
}
else
{
if (EImportType::ImportMeshType == Type)
{
ExtensionStr = TEXT("FBX Files|*.fbx");
}
else
{
ExtensionStr = TEXT("JPG,BMP,PNG files|*.jpg;*.png;*.bmp");
}
}
DesktopPlatform->OpenFileDialog(nullptr, TEXT("Open Dir"), FPaths::ConvertRelativePathToFull(FPaths::GameDir()), TEXT(""), *ExtensionStr, EFileDialogFlags::None, OpenFilenames);