RAD Studio 10.4.1 is now available! Learn more. Looking for discounts? Visit our Special Offers page!
C++DelphiTech Partner

Enable Windows Portable Devices (WPD) feature in your Delphi and C++ Builder Projects!

Overview

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.

Intro

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.

Specifications

  • 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:

Development

User Interface

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: 

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.

TTreeView in Action

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!


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial   Upgrade Today

   Free Delphi Community Edition   Free C++Builder Community Edition

About author

Software Developer | B.Tech-CSE at AUT | Delphi/C++ Builder Enthusiast | Microsoft Learn Student Ambassador | Microsoft Azure Certified | Udacity Alumni
Related posts
C++Code

Learn About Using Right Angle Brackets In This C++11 Feature For Windows Development

C++News

Using Python4Delphi with C++Builder (webinar)

C++CodeRAD Studio

Learn About The Initialization Of Class Objects By Rvalues In C++ Windows Development

C++Delphi

Ultimate Compression Toolkit For Delphi And C++ Builder Developers

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

IN THE ARTICLES