Table of Contents
The Windows Portable Devices (WPD) feature allows computers to communicate with the attached media and storage devices. With the WPD, you can explore a device, for instance, smartphones, flash USB cards, and many more.
If you want to enable the WPD feature in your Delphi and C++ Builder Windows application, you can utilize the Portable library by WINSOFT to connect WPD Application Programming Interfaces.
This is a commercial library that has a trial version with all features for evaluation only. If you wish to distribute the Portable library as a part of your project, you should get a license.
The Portable library by WINSOFT can be used for exploring devices, to send and receive content, and also to command devices. The library also supports Media Transport Protocol (MTP) and Mass Storage Class (MSC) devices.
- Supports Windows 32 & Windows 64
- Available for Delphi & C++ Builder 6-10.4 VCL
Configuration and Use
You can follow this installation video that shows how to configure your RAD Studio with this library.
You can also see the Portable library in action here:
Sometimes a user interface looks simple, but behind that, we have many processes going on—for instance, this demo. With the Combobox, you can select available devices, and with the TreeView, you can open folders and explore contents in that portable device.
Also, the Download, Upload and Delete buttons works as it is, Download downloads the file opens a dialog box to save it, Upload, uploads a file, and Delete, deletes selected file or data from a chosen portable device.
To use this Portable library, you should declare the Portable unit in your uses list. And you need several object instances to control devices, for example, TDeviceManager for getting available portable devices and TDeviceContent for showing the folders and files.
Let’s explore the OnCreate event now:
procedure TFormMain.FormCreate(Sender: TObject);
IdList := TStringList.Create;
DeviceManager := TDeviceManager.Create;
ComboBoxDevice.ItemIndex := 0;
for var I: Integer := 0 to DeviceManager.DeviceCount - 1 do
As you can see here we are getting the available portable devices using the DeviceManager instance.
Also, we have the AddChildren function, which helps to get available content from the selected portable device. With the TreeView component, we can display the contents with the right style, in this case, by showing parent and child style.
How are we getting the selected file from the portable device? We need TDeviceObject and TFileStream. If there is a selected object within the Device Object, it opens the save dialog, and then with TDeviceContent, we can start reading the data.
As you have guessed, uploading a file is like Content.Write
And deleting it can be done by Content.Delete function.
Be sure to investigate other features of the Portable library by WINSOFT, and see what else you can accomplish!
Like what you see? You can get the Portable library and over 100 other fantastic WinSoft components with our Enterprise Component Pack. For a limited time, when you purchase RAD Studio Enterprise or Architect Edition at special Upgrade Pricing, you will also get this package of third-party software worth over $13,000, including the full WinSoft Component Library, at NO EXTRA COST! Step up to RAD Studio 10.4 today!