MTP (Media transfer protocol) in Delphi

For more information see this question

All is working fine, except I now find one thing is missing - I need to be able to  create folders on the device.

So I need to the code that would do this, or preferably just update the demo project to include an example (via another button)
mtp10.zip
Clyde24Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sinisa VukSoftware architectCommented:
So... added create folder functionality and fix some stuff.
this is done as recursive function (again) - so you can add full path with few sub-folders which doesn't exists at all.

It is very similar to copy file to specific folder on device....
mtp11.zip
Clyde24Author Commented:
Unfortunately the new code in V11 won't compile for me (V10 is still OK).

error1
error2error2.png
Sinisa VukSoftware architectCommented:
And if you declare function like
function TForm12.GetDeviceId: WideString;
...

Open in new window

?
Introduction to Web Design

Develop a strong foundation and understanding of web design by learning HTML, CSS, and additional tools to help you develop your own website.

Clyde24Author Commented:
OK, it compiles but I can't create any folders. For example in the "create spec. folder" box I have:

s10001\Pictures\test

But I get the error "cannot create destination folder"

attached is the log
log.txt
Sinisa VukSoftware architectCommented:
Try this new one. Fixed few things... and Pos compile error too.
mtp12.zip

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Clyde24Author Commented:
Strange - it works when creating a folder in the root "s10001", but not anywhere deeper

For example entering the following works:

s10001\test

However, the following does not:

s10001\pictures\test

Log is attached
log.txt
Sinisa VukSoftware architectCommented:
Strange indeed. Works on my android phone, sd card, usb ...
But I have exposed drive letter, folders/files are with a real names....
Will look....
Clyde24Author Commented:
... also another issue I noticed - I Need to know the exact name of the device as shown in Windows explorer. For example, I have a "Garmin Oregon 650" GPSr unit connected:

gpsr
However, when I interrogate the mtp_demo log I can't see this exact reference (the 650 is missing, which is very important as that is the model number):

FriendlyName len=7
FriendlyName=GARMIN
DeviceDescription len=13
DeviceDescription=Oregon Flash

Open in new window


How can we get the exact name as shown by Windows explorer
Sinisa VukSoftware architectCommented:
Can you post log for this Garmin issue....
using this newer example...
mtp13.zip
Clyde24Author Commented:
log attached
log.txt
Mike McCrackenSenior ConsultantCommented:
I've requested that this question be deleted for the following reason:

The question has either no comments or not enough useful information to be called an "answer".
Clyde24Author Commented:
I changed the code to just delete a single folder and it worked
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.