UWP JavaScript应用程序:使用参数运行win32 EXE
从JavaScript UWP应用程序(Windows周年更新)调用win32可执行文件的最佳工作方式是什么 我已尝试通过AppService配置win32:UWP JavaScript应用程序:使用参数运行win32 EXE,javascript,uwp,windows-10,windows-10-universal,Javascript,Uwp,Windows 10,Windows 10 Universal,从JavaScript UWP应用程序(Windows周年更新)调用win32可执行文件的最佳工作方式是什么 我已尝试通过AppService配置win32: <uap:Extension Category="windows.appService" StartPage="www\index.html"> <uap:AppService Name="CommunicationService" /> </uap:Extension> <deskto
<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" />
现在我可以从JavaScript中使用Windows.ApplicationModel.FullTrustProcessLauncher.launchFullTrustProcessForCurrentAppAsync()启动它,但是如何使用参数启动它呢
但是如何使用参数启动它呢
您可以使用此方法的参数版本:
并清除appxmanifest文件中的参数:
<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>
提供的传递参数的机制目前似乎不允许您动态地传递参数,这是不理想的。您只能将硬编码参数传递给流程。我建议在UWP应用程序中使用应用程序服务扩展,使数据可用于完全信任过程。该过程被记录在案 这样做: 启动完全信任流程。添加一个参数以指示它是从UWP启动的
在完全信任流程中,检查是否传入了参数,并回调UWP流程的应用程序服务任务,以获取本应作为参数传入的数据。但看起来参数只能在清单中定义,对吗?那么,如何为调用使用动态参数呢?是的,参数只能在清单中定义,并且
GroupId
可以作为参数传递给方法。我想不出其他的方法来传递参数。嗯,但这是没有用的。应该有一种方法可以在运行时定义参数。您可以在appmanifest中定义所有参数,并且在运行期间动态更改GroupId
,以决定使用哪个参数。此外,欢迎您通过Windows反馈应用程序提供功能请求反馈,以帮助我们改进工作。您是否找到了这样做的方法?我同意你的观点,参数组是无用的,因为你不能通过运行时args@mikeysee:不,我现在正在尝试appservice Approach