Windows MTP/WPD 与 Android 设备通信

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7912743/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 18:21:59  来源:igfitidea点击:

Windows MTP/WPD communication with Android device

c++windowsusbwpd

提问by giZm0

I'm developing a PC c++ application running on windows. The application shall communicate with an android phone connected thru USB, using MTP. The idée is to not mount the Storage Card. What I have found is that Windows have something they call WPD (Windows Portable Device ) which supports MTP. It looks pretty ok but it demands WMP11 to be installed. What I wondering:

我正在开发在 Windows 上运行的 PC c++ 应用程序。该应用程序应使用 MTP 与通过 USB 连接的安卓手机进行通信。想法是不安装存储卡。我发现 Windows 有一些他们称之为 WPD(Windows 便携式设备)的东西,它支持 MTP。它看起来还不错,但它需要安装 WMP11。我想知道的是:

  • Is there are any other alternatives libraries you can use?
  • Do any one have any tips or experience about using WPD?
  • Are there any "leaner" dependencies you can install instead of WMP11 for xp?
  • 您可以使用其他任何替代库吗?
  • 有没有人有使用 WPD 的任何提示或经验?
  • 对于 xp,是否可以安装任何“更精简”的依赖项而不是 WMP11?

Any help would be greatly appreciated.

任何帮助将不胜感激。

采纳答案by giZm0

I here provide some answers to my question for the hope that it will help some one else.

我在这里为我的问题提供了一些答案,希望它能对其他人有所帮助。

Is there any alternatives/leaner libraries?

有没有替代品/更精简的图书馆?

  • You can use WIA but that is only used for images. but a part from that I have not found any.
  • 您可以使用 WIA,但这仅用于图像。但其中的一部分我还没有找到。

Any tips?

有小费吗?

  • Check out the sample code providedby Microsoft, it is a good start point. I found it be searching for Portable Devices COM API Sampleon MSDN
  • For Services you can check out this sample code. Which I found by googling for WpdServicesApiSample
  • The WPD api is pretty ok to use.
  • Not all devices support MTP and some only support part of it. This caused me some problem but the device we used released an update which supported more of MTP
  • I found the answer about XP-problems from this StackOverflowby pcbbc really helpful. I can also add that we mailed the supplier and asked for a custom .INF file to support XP and they were really helpful and provided us with it. But it took some time before we got it.
  • 查看Microsoft提供示例代码,这是一个很好的起点。我发现它正在MSDN 上搜索便携式设备 COM API 示例
  • 对于服务,您可以查看此示例代码。我通过谷歌搜索WpdServicesApiSample找到的
  • WPD api 非常好用。
  • 并非所有设备都支持 MTP,有些设备仅支持其中的一部分。这给我带来了一些问题,但我们使用的设备发布了支持更多 MTP 的更新
  • 我从pcbbc 的StackOverflow 中找到了有关 XP 问题的答案,真的很有帮助。我还可以补充一点,我们邮寄了供应商并要求提供自定义 .INF 文件以支持 XP,他们真的很有帮助并为我们提供了它。但是我们花了一些时间才得到它。