Unable to show Share UI in desktop bridge app

这一生的挚爱 提交于 2019-12-12 23:33:04

问题


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:

Element not found.

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

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.

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);

Any help is appreciated.

Update

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


回答1:


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.

Thank you for reporting the issue!

Update

Fix is available in build 17024 and above



来源:https://stackoverflow.com/questions/46327238/unable-to-show-share-ui-in-desktop-bridge-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!