Worawit Sudjitrak
Worawit Sudjitrak

Reputation: 5

Process.Start() Open exe file nothing hapen in UWP

no Error just nothing happen and file target still there in my path

public void keyboard(){

    ProcessStartInfo touchkey = new ProcessStartInfo(@"C:\Program 
    Files\Common Files\microsoft shared\ink\TabTip.exe");
    touchkey.WorkingDirectory = @"C:\";
    touchkey.WindowStyle = ProcessWindowStyle.Hidden;
    Process.Start(touchkey);
 } 

Update

The suggested solution threw a `UnauthorizedAccessException`:

var path = @"ms-appx://C:/Program Files/Common Files/microsoft 
shared/ink/TabTip.exe";
var file = await 

Windows.ApplicationModel.Package.Current.InstalledLocation.GetFileAsync(path); await Windows.System.Launcher.LaunchFileAsync(file);

Update2

I try to use FullTrustProcessLauncher it's work fine but like code before Keyboard tabtip.exe not show I dont know what should I do

   await Dispatcher.RunAsync(CoreDispatcherPriority.High, () =>
     {
      FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();

     });

Upvotes: 0

Views: 1093

Answers (3)

Tom
Tom

Reputation: 5

Make sure you edited the manifest file and add the extension for full trust process in the application.

Upvotes: 0

Martin Zikmund
Martin Zikmund

Reputation: 39072

Without TabTip.exe

I recognize you are trying to show the on-screen keyboard judging by the path of the exe. I suggest a better approach would be to trigger the new touch-enabled keyboard which is easily possible without additional hassle from UWP with InputPane API:

var pane = InputPane.GetForCurrentView();
pane.TryShow();

With TabTip.exe

If you prefer the older on-screen keyboard for some reason, you have two problems with your existing code.

Firstly, ms-appx: scheme is used to refer to files at the application installation path. The path you require is an absolute path, so you can't use it there.

Secondly, as this is an arbitrary path on the hard drive, you don't have access to it directly (as UWP apps run in a sandbox and can't access the filesystem directly for security reasons). To access the file, you will need to declare the broadFileSystemAccess capability, which will then allow you to initialize the StorageFile instance. You can check for example this SO question to learn how to do just that.

Note: I don't have my VS PC around so I can't say for sure if this will allow you to launch the executable or not, as that seems like an additional permission which may not be granted. In case this fails, I strongly recommend the first solution.

Upvotes: 2

Aleks
Aleks

Reputation: 1689

UWP applications are sandboxed and cannot launch other processes directly due to security restrictions.

The only way to launch other applications is if those applications have a URI registered, or an application is a default handler for a particular file type.

In those instances, you can use methods such as LaunchUriAsync or LaunchFileAsync

Upvotes: 2

Related Questions