从转换为uwp的桌面应用程序拖放文件 [英] File drag drop from a desktop app converted to uwp

查看:91
本文介绍了从转换为uwp的桌面应用程序拖放文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力将我的桌面应用程序(mfc)转换为uwp(https://msdn.microsoft.com/windows/uwp/porting/desktop-to-uwp-root)


我目前的问题是我的应用程序将文件写入我的应用程序认为的当前用户应用程序数据文件夹


C:\ Users \ < user> \ AppData \Roaming\< app> \< some file>


然后允许用户将该文件拖放到我的应用中。 问题是,当我保存该文件时,它会被路由到$


C:\ Users \< user> \ AppData \ Local \ Packages \\ \\< app> _fys03603xa45r\LocalCache \Roaming\< app> \< some file>


我拖放的路径是C:\ Users \< user> \ AppData \ Rooaming \< app> \ < some file>但是文件实际上并不存在于不同的文件夹中,因为事情已被重定向。


有关处理此问题的任何建议吗?我能找到真正的道路吗? 我可以用于文件拖放的任何其他已知文件夹。 


一种方法是允许用户在我可以写入并拖动的系统上定义一些文件夹,但我不想为此添加一些设置。 / p>

解决方案

看起来这是特别提到的,https://msdn.microsoft.com /en-us/windows/uwp/porting/desktop-to-uwp-root. 所以可能做的不多。


您的应用程序写入AppData文件夹,目的是与其他应用程序共享数据。转换后,AppData将重定向到本地应用程序数据存储,这是每个UWP应用程序的私有存储。使用不同的进程间
数据共享方式。有关详细信息,请参阅
存储和检索设置及其他应用程序数据


I'm working on converting my desktop app (mfc) to uwp (https://msdn.microsoft.com/windows/uwp/porting/desktop-to-uwp-root)

My current problem is that my app writes a file to what my app thinks is the current users app data folder

C:\Users\<user>\AppData\Roaming\<app>\<some file>

and then allows the user to drag and drop that file out of my app.  The problem is that when i save that file it gets routed to

C:\Users\<user>\AppData\Local\Packages\<app>_fys03603xa45r\LocalCache\Roaming\<app>\<some file>

The path i place on my drag and drop is C:\Users\<user>\AppData\Roaming\<app>\<some file> but the file isn't actually there it's in a different folder because things got redirected.

Any suggestions on handling this? Can i get the real path?  Any other known folders i can use for my file drag drop. 

One way is to allow the user to define some folder on the system i can write to and drag from but i don't want to add some setting for this.

解决方案

Looks like this is specifically mentioned, https://msdn.microsoft.com/en-us/windows/uwp/porting/desktop-to-uwp-root.  So probably not much can be done.

Your app writes to the AppData folder with the intention of sharing data with another app. After conversion, AppData is redirected to the local app data store, which is a private store for each UWP app. Use a different means of inter-process data sharing. For more info, see Store and retrieve settings and other app data.


这篇关于从转换为uwp的桌面应用程序拖放文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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