Do you need to identify Storage Devices available or connected to the machine and perform some programmatically actions to the Storage Devices? How do enumerate among the Storage Devices quickly? Don’t know how to do it? Don’t worry. MiTec’s System Information Management Suite component helps to enumerate the available Internal or External Storage devices, and we will learn how to use the TMiTec_Storage, TMiTeC_Disk component in this blog post.
Platforms: Windows.
Installation Steps:
You can easily install this Component Suite from GetIt Package Manager. The steps are as follows.
- Navigate In RAD Studio IDE->Tools->GetIt Package Manager->select Components in Categories->Components->Trail -MiTec system Information Component Suite 14.3 and click Install Button.
- Read the license and Click Agree All. An Information dialog saying ‘Requires a restart of RAD studio at the end of the process. Do you want to proceed? click yes and continue.
- It will download the plugin and installs it. Once installed Click Restart now.
How to run the Demo app:
- Navigate to the System Information Management Suite trails setup, Demos folder which is installed during Get It installation e.g) C:UsersDocumentsEmbarcaderoStudio21.0CatalogRepositoryMiTeC-14.3DemosDelphi5
- Open the DiskView project in RAD studio 10.4.1 Compile and Run the application.
- This Demo App shows how to list down the internal and external storage devices, enumerate among them and access its properties.
Components used in MSIC DiskView Demo App:
- TMiTeC_Disk: Detects properties of given logical disk.
- TMiTeC_Storage: Enumerates logical drives and physical storage devices as disks, tapes, CD/DVD etc.
- TMiTeC_DeviceMonitor : Catches USB, Bluetooth devices or TV/monitor connection/disconnection, volumes mount/unmount, CD/DVD insert/eject and other events from other devices
- TTreeView to list the Storage Device nodes and TListView to show the Selected Storage Device properties.
- TButton’s to save and refresh.
Implementation Details:
- An instance is created Storage of TMiTeC_Storage, Disk of TMiTeC_Disk and DeviceMonitor of TMiTeC_DeviceMonitor were created. Call cmRefresh where list of Storage devices were added to the tree node by loop through Storage.PhysicalCount. Further the list of Logical partitions were added to the physical tree node by loop through storage.LogicalCount. For each logical partitions, some of the logical storage device properties were listed in the list view.
- Display the selected Disk View properties on TreeChange event as shown below.
- Use DeviceMonitor events OnVolumeConnect,OnVolumeDisconnect to identify the Storage device arrival/removal and refresh the tree view accordingly.
It’s that simple to enumerate Storage Devices connected and list their properties for your application. Use this MiTeC component suite and get the job done quickly.
Learn how you can take advantage of a powerful and flexible hard disk space manager called TreeSize in this article.
With the use of a Windows IDE, you can easily access storage device information in your Delphi Windows apps with a component suite. Try your Free Trial here.