Easily Browse Your Windows Devices From Your Delphi App With Powerful Components
February 26, 2021 By Anbarasan
Sometimes Developers want to list down or identify the Devices in a Windows machine programmatically. How to enumerate among the devices and resources quickly ? Don’t know how to do. Don’t worry. Для просмотра ссылки Войдиили Зарегистрируйся System Information Management Suite’s component helps to do that effectively and we will learn how to retrieve devices similar to Windows device manager.
Platforms: Windows.
Installation Steps:
You can easily install this Component Suite from GetIt Package Manager. The steps are as follows.

MiTeC DeviceBrowser Demo

evice Properties

Resources
These simple steps is sufficient to retrieve Devices and its properties in your application. Use this MiTeC component suite and get the job done quickly.
February 26, 2021 By Anbarasan
Sometimes Developers want to list down or identify the Devices in a Windows machine programmatically. How to enumerate among the devices and resources quickly ? Don’t know how to do. Don’t worry. Для просмотра ссылки Войди
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.
- Navigate to the System Information Management Suite trails setup, Demos folder which is installed during Get It installation e.g) C:UsersDocumentsEmbarcaderoStudio21.0CatalogRepositoryMiTeC-14.3DemosDelphi13
- Open the DeviceBrowser project in RAD studio 10.4.1 compile and Run the application.
- This Demo App shows how to list down the known windows devices, device resources, enumerate among them and access its properties.
- TMiTeC_Devices Enumerates all known devices and their properties. (It does the same as Windows Device Manager)
- TTabsheet’s one for viewing Devices list in TTreeView and other for viewing Resources in TListView.
- TButton to view the details, resources of the device in a new child form.
- An instance Devices of TMiTeC_Devices Call RefreshData where list of Windows devices were added to the tree node by loop through DeviceCount property. A list of resources were added to the listview items from the GetResourceList procedure.
Код:
procedure Twnd_db_Main.RefreshData;
var
i,c,ii: integer;
r,n: TTreeNode;
lcn,cn,dn: string;
pi: PInteger;
RL: TResourceList;
ilh: THandle;
g: TGUID;
begin
Devices.RefreshData;
lcn:='';
with Devices, Tree,Items do begin
c:=DeviceCount-1;
BeginUpdate;
while Count>0 do begin
if Assigned(Items[Count-1].Data) then
FreeMem(Items[Count-1].Data);
Delete(Items[Count-1]);
end;
r:=Add(nil,GetMachine);
r.ImageIndex:=0;
r.SelectedIndex:=r.ImageIndex;
n:=nil;
for i:=0 to c do begin
if (Trim(Devices[i].ClassDesc)<>'') then
cn:=Devices[i].ClassDesc
else
cn:=Devices[i].ClassName;
if not Assigned(n) or not SameText(Devices[i].ClassName,lcn) then begin
lcn:=Devices[i].ClassName;
n:=AddChild(r,cn);
g:=Devices[i].ClassGUID;
SetupDiGetClassImageIndex(spid,g,ii);
n.ImageIndex:=ii;
n.SelectedIndex:=n.ImageIndex;
end;
dn:=Devices[i].Name;
with AddChild(n,dn) do begin
ImageIndex:=n.ImageIndex;
SelectedIndex:=ImageIndex;
new(pi);
pi^:=i;
Data:=pi;
end;
n.AlphaSort;
end;
r.AlphaSort;
r.Expand(False);
EndUpdate;
end;
tsDevRes.TabVisible:=Devices.LiveData;
bRes.Visible:=Devices.LiveData;
if Devices.LiveData then
with Devices, ResList, Items do begin
GetResourceList(RL);
BeginUpdate;
try
Clear;
for i:=0 to High(RL) do
with Add do begin
Caption:=RL[i].Resource;
SubItems.Add(ResourceShareStr(RL[i].Share));
SubItems.Add(RL[i].Device);
g:=RL[i].DeviceClassGUID;
SetupDiGetClassImageIndex(spid,g,ii);
ImageIndex:=ii;
end;
finally
EndUpdate;
end;
end;
end;

MiTeC DeviceBrowser Demo
- On clicking the Properties button for the selected tree node item, its properties such as Class Description, GUID, Manufacturer, Hardware ID etc were displayed in a child form.
Код:
procedure Twnd_db_Main.cmProps(Sender: TObject);
var
dr: TDevice;
i,ii: integer;
h: HICON;
g: TGUID;
begin
if Assigned(Tree.Selected) and (Tree.Selected.Level=2) then
with Tdlg_db_Detail.Create(self) do begin
lv.items.clear;
i:=PInteger(Tree.Selected.Data)^;
dr:=Devices.Devices[i];
g:=dr.ClassGUID;
SetupDiLoadClassIcon(g,h,ii);
Icon.Picture.Icon.Handle:=h;
eName.Text:=dr.Name;
with lv.Items.Add do begin
Caption:='Class Name';
Subitems.Add(dr.ClassName);
ImageIndex:=-3;
end;
with lv.Items.Add do begin
Caption:='Class Description';
Subitems.Add(dr.ClassDesc);
end;
with lv.Items.Add do begin
Caption:='Class GUID';
Subitems.Add(dr.GUID);
end;
with lv.Items.Add do begin
Caption:='Registry Key';
Subitems.Add(dr.RegKey);
end;
with lv.Items.Add do begin
Caption:='Manufacturer';
Subitems.Add(dr.Manufacturer);
end;
with lv.Items.Add do begin
Caption:='Hardware ID';
Subitems.Add(dr.HardwareID);
end;
with lv.Items.Add do begin
Caption:='SymbolicLink';
Subitems.Add(dr.SymbolicLink);
end;
with lv.Items.Add do begin
Caption:='Location';
Subitems.Add(Format('%s',[dr.Location]));
end;
with lv.Items.Add do begin
Caption:='PCI Number';
Subitems.Add(Format('%d',[dr.PCINumber]));
end;
with lv.Items.Add do begin
Caption:='Device Number';
Subitems.Add(Format('%d',[dr.DeviceNumber]));
end;
with lv.Items.Add do begin
Caption:='Function Number';
Subitems.Add(Format('%d',[dr.FunctionNumber]));
end;
with lv.Items.Add do begin
Caption:='Vendor ID';
Subitems.Add(Format('%4.4x',[dr.VendorID]));
end;
with lv.Items.Add do begin
Caption:='Device ID';
Subitems.Add(Format('%4.4x',[dr.DeviceID]));
end;
with lv.Items.Add do begin
Caption:='SubSystem';
Subitems.Add(Format('%8.8x',[dr.SubSysID]));
end;
with lv.Items.Add do begin
Caption:='Revision';
Subitems.Add(Format('%2.2x',[dr.Revision]));
end;
with lv.Items.Add do begin
Caption:='';
ImageIndex:=-2;
end;
with lv.Items.Add do begin
Caption:='Driver Description';
SubItems.Add(dr.Driver);
ImageIndex:=-3;
end;
with lv.Items.Add do begin
Caption:='Driver Version';
SubItems.Add(dr.DriverVersion);
end;
with lv.Items.Add do begin
Caption:='Driver Date';
SubItems.Add(dr.DriverDate);
end;
with lv.Items.Add do begin
Caption:='Driver Provider';
SubItems.Add(dr.DriverProvider);
end;
with lv.Items.Add do begin
Caption:='Driver GUID';
SubItems.Add(dr.DriverKey);
end;
with lv.Items.Add do begin
Caption:='Image Path';
SubItems.Add(dr.ImagePath);
end;
with lv.Items.Add do begin
Caption:='';
ImageIndex:=-2;
end;
with lv.Items.Add do begin
Caption:='Service Name';
if dr.ServiceName='' then
SubItems.Add(dr.Service)
else
SubItems.Add(dr.ServiceName);
ImageIndex:=-3;
end;
with lv.Items.Add do begin
Caption:='Service Group';
SubItems.Add(dr.ServiceGroup);
end;
with lv.Items.Add do begin
Caption:='';
ImageIndex:=-2;
end;
with lv.Items.Add do begin
Caption:='Install ID';
SubItems.Add(dr.InstallID);
ImageIndex:=-3;
end;
with lv.Items.Add do begin
Caption:='Install Date';
SubItems.Add(DateTimeToStrDef(dr.InstallDate));
end;
with lv.Items.Add do begin
Caption:='First Install Date';
SubItems.Add(DateTimeToStrDef(dr.FirstInstallDate));
end;
with lv.Items.Add do begin
Caption:='Last Arrival Date';
SubItems.Add(DateTimeToStrDef(dr.LastArrivalDate));
end;
with lv.Items.Add do begin
Caption:='Last Removal Date';
SubItems.Add(DateTimeToStrDef(dr.LastRemovalDate));
end;
showmodal;
DestroyIcon(h);
free;
end;
end;

evice Properties
- Similarly On Clicking Resources , the selected tree node TDeviceResources properties were shown.

Resources
These simple steps is sufficient to retrieve Devices and its properties in your application. Use this MiTeC component suite and get the job done quickly.