资源简介
一个实用的Demo,可以通过MTP(多媒体传输)协议和便携设备进行通信交互,读取便携设备信息,从便携设备upload\download文件。(微软官方例子)

代码片段和文件信息
// THIS CODE AND INFORMATION IS PROVIDED “AS IS“ WITHOUT WARRANTY OF
// ANY KIND EITHER EXPRESSED OR IMPLIED INCLUDING BUT NOT LIMITED TO
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// Copyright (c) Microsoft Corporation. All rights reserved.
#include “stdafx.h“
// This number controls how many object identifiers are requested during each call
// to IEnumPortableDeviceobjectIDs::Next()
//
#define NUM_objectS_TO_REQUEST 10
// Recursively called function which enumerates using the specified
// object identifier as the parent.
void RecursiveEnumerate(
_In_ PCWSTR objectID
_In_ IPortableDeviceContent* content)
{
ComPtrjectIDs> enumobjectIDs;
// Print the object identifier being used as the parent during enumeration.
wprintf(L“%ws\n“ objectID);
// Get an IEnumPortableDeviceobjectIDs interface by calling Enumobjects with the
// specified parent object identifier.
HRESULT hr = content->Enumobjects(0 // Flags are unused
objectID // Starting from the passed in object
nullptr // Filter is unused
&enumobjectIDs);
if (FAILED(hr))
{
wprintf(L“! Failed to get IEnumPortableDeviceobjectIDs from IPortableDeviceContent hr = 0x%lx\n“ hr);
}
// Loop calling Next() while S_OK is being returned.
while(hr == S_OK)
{
DWORD numFetched = 0;
PWSTR objectIDArray[NUM_objectS_TO_REQUEST] = {0};
hr = enumobjectIDs->Next(NUM_objectS_TO_REQUEST // Number of objects to request on each NEXT call
objectIDArray // Array of PWSTR array which will be populated on each NEXT call
&numFetched); // Number of objects written to the PWSTR array
if (SUCCEEDED(hr))
{
// Traverse the results of the Next() operation and recursively enumerate
// Remember to free all returned object identifiers using CoTaskMemFree()
for (DWORD index = 0; (index < numFetched) && (objectIDArray[index] != nullptr); index++)
{
RecursiveEnumerate(objectIDArray[index] content);
// Free allocated PWSTRs after the recursive enumeration call has completed.
CoTaskMemFree(objectIDArray[index]);
objectIDArray[index] = nullptr;
}
}
}
}
//
// Enumerate all content on the device starting with the
// “DEVICE“ object
//
void EnumerateAllContent(
_In_ IPortableDevice* device)
{
HRESULT hr = S_OK;
ComPtr content;
// Get an IPortableDeviceContent interface fro
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 1268 2013-10-17 17:30 Portable Devices COM API Sample\C++\CommonFunctions.h
文件 12498 2013-10-17 17:30 Portable Devices COM API Sample\C++\ContentEnumeration.cpp
文件 47717 2013-10-17 17:30 Portable Devices COM API Sample\C++\ContentProperties.cpp
文件 69925 2013-10-17 17:30 Portable Devices COM API Sample\C++\ContentTransfer.cpp
文件 572 2014-02-16 21:35 Portable Devices COM API Sample\C++\Debug\WpdApiSample.log
文件 36813 2013-10-17 17:30 Portable Devices COM API Sample\C++\DeviceCapabilities.cpp
文件 17887 2013-10-17 17:30 Portable Devices COM API Sample\C++\DeviceEnumeration.cpp
文件 4426 2013-10-17 17:30 Portable Devices COM API Sample\C++\DeviceEvents.cpp
文件 1930 2013-10-17 17:30 Portable Devices COM API Sample\C++\ReadMe.txt
文件 1957 2013-10-17 17:30 Portable Devices COM API Sample\C++\stdafx.h
文件 11671 2013-10-17 17:30 Portable Devices COM API Sample\C++\WpdApiSample.cpp
文件 479232 2014-02-18 22:51 Portable Devices COM API Sample\C++\WpdApiSample.sdf
文件 2233 2013-10-17 17:30 Portable Devices COM API Sample\C++\WpdApiSample.sln
文件 3584 2014-02-18 22:51 Portable Devices COM API Sample\C++\WpdApiSample.suo
文件 10399 2013-10-17 17:30 Portable Devices COM API Sample\C++\WpdApiSample.vcxproj
文件 143 2014-02-16 21:33 Portable Devices COM API Sample\C++\WpdApiSample.vcxproj.user
文件 5834 2013-10-17 17:30 Portable Devices COM API Sample\desc
文件 71561 2013-10-17 17:30 Portable Devices COM API Sample\desc
文件 0 2013-10-17 17:30 Portable Devices COM API Sample\desc
文件 0 2013-10-17 17:30 Portable Devices COM API Sample\desc
文件 10455 2013-10-17 17:30 Portable Devices COM API Sample\desc
文件 7344 2013-10-17 17:30 Portable Devices COM API Sample\desc
文件 1727 2013-10-17 17:30 Portable Devices COM API Sample\desc
文件 1670 2013-10-17 17:30 Portable Devices COM API Sample\desc
文件 10721 2013-10-17 17:30 Portable Devices COM API Sample\desc
文件 4688 2013-10-17 17:30 Portable Devices COM API Sample\license.rtf
目录 0 2014-02-18 20:49 Portable Devices COM API Sample\C++\ipch\wpdapisample-db914964
目录 0 2014-02-16 21:35 Portable Devices COM API Sample\C++\Debug
目录 0 2014-02-18 20:49 Portable Devices COM API Sample\C++\ipch
目录 0 2014-02-18 22:51 Portable Devices COM API Sample\C++
............此处省略5个文件信息
相关资源
- MikroTik RouterOS密码破解 mtpass.exe
- MTP USB驱动win7 32+64位可用版
- MTP设备驱动安装失败修复工具.zip
- smtp 发送邮件给多个用户带附件
- 1.规格书 MTP10-B7F55(中文版-d).pdf
- 1.规格书 MTP10-B7F55(中文版).pdf
- 最新SMTP探测新版.zip
- EMTP Theory Book
- ATP-EMTP资料汇总模型23个,手册及文献
- smtp邮件服务器的编写程序
- 邮件协议报文
- 最新SMTP企业邮箱探测器
- socket编程基础编写基于GUI界面的SMTP客
- QT利用SMTP发送邮件Demo
- ATP-EMTP的电力设备模型
- 简单电子邮件客户端的设计与实现.
- SMTP电子邮件客户端与服务器的设计与
- ATP-EMTP模型
- THINKPAD写号软件usbfmtpw.exe.rar
- 基于 POP3 和 SMTP 的 邮件服务端和移动
- PMSM电机MTPA推导
- SMTP破解器25.80.465.587端口
- ATP-EMTP 电磁仿真软件参考书
- 电磁暂态f仿真软件ATP-EMTP
- EMTP-ATP5.9
- ATP-EMTP软件
- Wireshark抓包分析POP3和SMTP协议
- SMTP邮件发送客户端.rar
- 电机标定报告.pdf
- 基于LabVIEW2013的远程多点温度测控系统
评论
共有 条评论