2
votes

What is the best working way to call a win32 executable from JavaScript UWP app (Windows Anniversary update)

I have tried to configure the win32 via an AppService:

<uap:Extension Category="windows.appService" StartPage="www\index.html">
    <uap:AppService Name="CommunicationService" />
</uap:Extension>

<desktop:Extension Category="windows.fullTrustProcess" Executable="mywin32app.exe" EntryPoint="Windows.FullTrustApplication" />

Now I can launch it with Windows.ApplicationModel.FullTrustProcessLauncher.launchFullTrustProcessForCurrentAppAsync() from JavaScript, but how do I launch It with parameters?

2
Did you every find a way to do this? I agree with you, the Parameter groups are useless as you cant pass runtime args - mikeysee
@mikeysee: no I try the appservice aproach right now - Daniel Toplak

2 Answers

1
votes

but how do I launch It with parameters

There is a with-parameter version of this method that you can use: FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync(String).

And declear the parameters in appxmanifest file:

<desktop:Extension Category="windows.fullTrustProcess" Executable="fulltrustprocess.exe"> 
      <desktop:FullTrustProcess> 
        <desktop:ParameterGroup GroupId="SyncGroup" Parameters="/Sync"/> 
        <desktop:ParameterGroup GroupId="OtherGroup" Parameters="/Other"/> 
      </desktop:FullTrustProcess> 
</desktop:Extension> 
0
votes

The provided mechanism for passing parameters doesn't seem to allow you to do them dynamically at the moment, which is not ideal. You can only pass through hard-coded parameters to your process. I suggest using an App Service extension in your UWP app to make data available to your full trust process. The process is documented here.

Do it this way:

Launch full trust process. Add a parameter to indicate that it is launched from UWP.

In your full trust process, check if the parameter was passed in, and call back to the UWP process' app service task to get the data you would otherwise pass in as a parameter.