简体   繁体   中英

Accessing the files of the Plug and Play android device via WIN API

Let me keep my explanation simple. I am writing a simple windows service, to detect android devices connected to the computer via USB and access the device's memory to read camera photos.

Using RegisterDeviceNotification() in the WIN API we can get registered to get notified for any device change (Devices added/removed from the computer). In my case I register to get notified when the USB devices are connected to the computer. So when a volume device is connected we can get the drive letter using dbcv_unitmask from the PDEV_BROADCAST_VOLUME structure. This works absolutely well for a USB drive. I can then access my USB drive because of the known drive letter.

But, in my case the android device connects using MTP protocol and windows does recognize a new USB device being attached but does not seem to assign a drive letter to it. So, now I have no way to access the memory of the device programmatically.

Please let me know if there is a way to access the android PNP device via WIN API.

Thanks!

因此,替代方法是使用WPD(Windows便携式设备API)访问mtp设备。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM