我可以从 UWP 应用的进程外后台任务中启动 FullTrust Win32 应用吗?

问题描述

我需要在每次系统登录时读取注册表以确定是否启动通知。因此,我必须使用 SystemTriggerType.SessionConnected 创建一个进程外后台任务来执行此操作。后台任务实现如下所示:

public async void Run(IBackgroundTaskInstance taskInstance)
{
    
    Task launchFullTrust = LaunchFullTrustProcessForCurrentAppAsync(); //Windows.ApplicationModel.FullTrustProcessLauncher as an async task
    launchFullTrust.Wait();

    BackgroundTaskDeferral appServiceDeferral = taskInstance.GetDeferral();
    AppServiceTriggerDetails details = taskInstance.TriggerDetails as AppServiceTriggerDetails;
    Connection = details.AppServiceConnection; // AppServiceConnection object
    ...
    // perform data acquisition
}

但是因为这个后台进程是由会话连接触发的,所以可以保证 taskInstance 不会包含 AppServiceTriggerDetails 或任何与 AppServiceTrigger 相关的内容。考虑到这一点,有没有办法从后台任务而不是从 UWP 应用程序本身接收 AppServiceConnection 连接的句柄?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)