如何构造mtp设备的路径(可在文件夹浏览对话框中使用)? [英] How to construct path for mtp devices (usable in folder browse dialog)?

查看:85
本文介绍了如何构造mtp设备的路径(可在文件夹浏览对话框中使用)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我实现了从Windows pc到Android设备的文件传输,该设备与MTP连接到了计算机.复制实现已准备就绪(我使用了以下示例: http://code.msdn.microsoft.com/windowsdesktop/Portable-Devices-COM-API-fd4a5f7d ).

I implemented file transfer from windows pc to an android device, which is connected with MTP to the computer. The copy implementation is ready (I used this example: http://code.msdn.microsoft.com/windowsdesktop/Portable-Devices-COM-API-fd4a5f7d).

现在,我想改善UI,我想提供一个文件夹选择对话框,用户可以在其中选择一个MTP设备文件夹,然后在其中保存文件(带有FOS_PICKFOLDERS的CLSID_FileOpenDialog效果很好).请注意,简单的文件保存对话框不起作用,因为您会从对话框中收到错误消息:您无法在此处保存".

Now I would like to improve UI, I would like to offer a folder selection dialog, where the user can select a MTP device folder, where I will save the file (CLSID_FileOpenDialog with FOS_PICKFOLDERS works nice). Note that simple file save dialog doesn't work, because you will get error from dialog: "You can’t save here".

文件夹浏览的结果将类似于以下内容:
:: {20D04FE0-3AEA-1069-A2D8-08002B30309D} \\?\ usb#vid_04e8& pid_6860& mi_00#6& 2296b879& 0& 0000#{6ac27878-a6fa-4155-ba85-f98f491d4f33} \ SID- {1000,SECZ9519043CHOHB,12635222016} {01B8016B-0164-00F2-E100-55012C014001}

The result of folder browsing will be similar to this:
::{20D04FE0-3AEA-1069-A2D8-08002B30309D}\\?\usb#vid_04e8&pid_6860&mi_00#6&2296b879&0&0000#{6ac27878-a6fa-4155-ba85-f98f491d4f33}\SID-{10001,SECZ9519043CHOHB,12635222016}{01B8016B-0164-00F2-E100-55012C014001}

usb#vid_04e8& pid_6860& mi_00#6& 2296b879& 0& 0000#{6ac27878-a6fa-4155-ba85-f98f491d4f33}
我知道这是设备,IPortableDeviceManager将此用作设备ID.

usb#vid_04e8&pid_6860&mi_00#6&2296b879&0&0000#{6ac27878-a6fa-4155-ba85-f98f491d4f33}
I know this is the device, IPortableDeviceManager use this as device id.

SID- {10001,SECZ9519043CHOHB,12635222016} \ {01B8016B-0164-00F2-E100-55012C014001}
这是设备上的路径.这些GUID是设备对象的WPD_OBJECT_PERSISTENT_UNIQUE_ID属性.

SID-{10001,SECZ9519043CHOHB,12635222016}\{01B8016B-0164-00F2-E100-55012C014001}
This is the path on device. These GUIDs are the WPD_OBJECT_PERSISTENT_UNIQUE_ID property of the device objects.

使用此信息,我可以选择设备并在设备中找到文件夹,以便进行复制.

With this information I can select the device and find the folder in the device, so I can do the copy.

我的问题是我也想在设备上的文件夹浏览对话框中选择一个默认目录,但是我无法创建上面提到的路径.请注意,如果我将其设置为默认路径,它将在正确的文件夹中开始浏览.

My problem is that I also would like to select a default directory in my folderbrowsedialog on the device, and I can't create the upper mentioned path. Note if I give that as a default path, it starts the browsing in the correct folder.

有问题的部分是启动GUID,我无法获得:
:: {20D04FE0-3AEA-1069-A2D8-08002B30309D}

The problematic part is the starting GUID, which I can't get:
::{20D04FE0-3AEA-1069-A2D8-08002B30309D}

我也调查了注册表.我仅在一个条目中找到了此GUID:
HKEY_USERS \ S-1-5-21-2044730494-4069800027-1247311059-1000 \ Software \ Microsoft \ Windows \ CurrentVersion \ Explorer \ CLSID {20D04FE0-3AEA-1069-A2D8-08002B30309D} \ DefaultIcon
这是哪个值:
C:\ Windows \ System32 \ imageres.dll,-109
(CLSID子文件夹包含更多的GUID,所以我找不到,这是正确的)

I also looked into registry. I found this GUID in only one entry:
HKEY_USERS\S-1-5-21-2044730494-4069800027-1247311059-1000\Software\Microsoft\Windows\CurrentVersion\Explorer\CLSID{20D04FE0-3AEA-1069-A2D8-08002B30309D}\DefaultIcon
which value is this:
C:\Windows\System32\imageres.dll,-109
(CLSID subfolder contains more GUID, so I can't find, which is the correct one)

您知道如何获取此GUID以便构建整个默认路径吗?

Do you have idea how to get this GUID to be able to construct the whole default path?

推荐答案

该guid表示计算机文件夹,MTP设备的外壳程序名称空间扩展名是计算机文件夹委托.您可以将此guid用作常量来构造文件夹浏览器的解析名称.

That guid represents the Computer folder, the shell namespace extension for MTP devices is a Computer folder delegate. You can use this guid as a constant to construct the parsing name for your folder browser.

关于,丽莎

这篇关于如何构造mtp设备的路径(可在文件夹浏览对话框中使用)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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