Delphi Quickly Get USB Devices History On Windows With These Components

FireWind

Свой
Регистрация
2 Дек 2005
Сообщения
1,957
Реакции
1,199
Credits
4,009
Quickly Get USB Devices History On Windows With These Components
By Anbarasan March 17, 2021

Sometimes Developers Want to list or Identify USB Devices History in a machine programmatically. Don’t know how to do. Don’t worry. Для просмотра ссылки Войди или Зарегистрируйся System Information Management Suite’s component helps to enumerate the USB Devices History we will learn how to use use the TMiTec_USBHistory 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.
  1. 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.
  2. 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.
  3. 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.3DemosDelphi25
  • Open the USBHistory project in RAD studio 10.4.1 compile and Run the application.
  • This Demo App shows how to list down the USB devices history in your machine, enumerate among them and access its key properties.
Components used in MSIC USBHistory Demo App:
  • TMiTeC_USBHistory: Enumerates all USB devices History and their properties.
  • TListView to show the connected USB Device History properties.
  • TButton’s to save, and close the application.
Implementation Details:
  • An instance is created USBHistory of TMiTeC_USBHistory. Call USBHistory.RefreshData, Add list of USB History to the TListView by loop through USBHistory.RecordCount. For each USBHistory Record get the properties such as Device Name, SerialNumber, Timestamp(lastseen), DeviceClass etc and add to list view subitems.
Код:
procedure TForm3.FormCreate(Sender: TObject);
var
  i: Integer;
begin
  USBHistory:=TMiTeC_USBHistory.Create(Self);
  USBHistory.RefreshData;
  for i:=0 to USBHistory.RecordCount-1 do
    with lv.Items.Add do begin
      Caption:=USBHistory.Records[i].Name;
      Subitems.Add(USBHistory.Records[i].SerialNumber);
      SubItems.Add(DateTimeToStr(USBHistory.Records[i].Timestamp));
      Subitems.Add(USBHistory.Records[i].DeviceClass);
    end;
  lv.AlphaSort;
end;
  • Display the selected USB Device History properties as shown below.
1616066828838.png
MiTeC_USBHistory Demo
  • It’s that simple to enumerate USB Devices History and list its properties for your application. Use this MiTeC component suite and get the job done quickly.