How to detect an MTP device and start copying files?

I have a VB application that currently detects when external drives are added (which receive drive letters) and starts copying specific files from them. It’s quite convenient, just connect the camera (say), and my application extracts the files it needs (optionally deleting it from an external device).

Some devices, such as GoPro Hero4, are not mounted with drive letters, but appear as MTP devices. My code does not detect this and what I would like a guide for.

Should I use the StorageDevice class? Some things WMI? WDP?

It looks like StorageDevice contains what I need, but the docs are kind of high-level, and I'm looking for a solid example, preferably in VB or C #. Any suggestions for a better solution?

Edit: Thanks for the link to another q & a control, but I think this is slightly different in: a) I would like to detect events related to connecting devices, not just copy files, and b) links to other q & to projects that are little documented. Maybe there is an answer, but I'm trying to just get the answer, and not dig the source code, which may or may not be what I need.

+4
source share
1 answer

, this , , "", .

Plug and Play .

0

Source: https://habr.com/ru/post/1605620/


All Articles