无法在桌面桥应用中显示共享 UI [英] Unable to show Share UI in desktop bridge app

查看:33
本文介绍了无法在桌面桥应用中显示共享 UI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在原生 UWP 应用中,我们可以通过调用 DataTransferManager.ShowShareUI 方法.

In native UWP apps, we can show share UI by calling DataTransferManager.ShowShareUI method.

DataTransferManager.ShowShareUI();

在桌面桥应用中调用此方法会引发异常:

Calling this method in a desktop bridge app raises an exception:

未找到元素.

应用在后台时无法调用此方法

This method cannot be called while the app is in the background

这在意料之中,因为桥接应用不使用 UWP 的 UI 元素.所以我尝试使用它应该在本机 Win32 应用程序中完成的方式.

That's kind of expected as the bridge app does not use the UI elements of UWP. So I tried to use way it should be done in native Win32 apps.

在原生 Win32 应用程序中,我们可以通过调用 DataTransferManagerHelper.ShowShareUIForWindow 方法.但是,桌面桥应用(在应用上下文中运行)中的此调用只会使 explorer.exe 崩溃.如果应用程序不是作为桥接应用程序运行,而是作为本机 Win32 应用程序运行,则完全相同的代码有效.

In native Win32 apps, we can show share UI by calling DataTransferManagerHelper.ShowShareUIForWindow method. However, this call in a desktop bridge app (that runs in an app context) does nothing but crashing explorer.exe. The exact same code works if the app does not run as a bridge app but as a native Win32 app.

IntPtr hwnd = new WindowInteropHelper(Application.Current.MainWindow).Handle; 
DataTransferManagerHelper.ShowShareUIForWindow(hwnd);

感谢任何帮助.

更新

此问题已在版本 17024 上修复.我成功运行代码以在最新的内部版本 (17101) 上打开共享 UI.

This issue has been fixed on build 17024. I successfully ran the code to open share UI on the latest insider build (17101).

推荐答案

我已经确认这是一个错误.一旦修复了错误,ShowShareUIForWindow() 将是为您的场景调用的正确 API.

I have confirmed that this is a bug. ShowShareUIForWindow() would be the right API to call for your scenario, once the bug is fixed.

我现在已将错误分配给正确的团队.

I have assigned the bug to the right team now.

感谢您报告问题!

更新

在 17024 及更高版本中提供修复

Fix is available in build 17024 and above

这篇关于无法在桌面桥应用中显示共享 UI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆