Author Topic: How can I cycle through the devices without using a device box ?  (Read 2266 times)

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Hi Paul

You can use TnrUsb.Device property for access to devices list. Please see following example:

uses nrusbman;

procedure TForm1.FormCreate(Sender: TObject);
var i : integer;
begin
  Memo1.Clear;
  nrUsb1.Update;  // refresh device list
  for i := 0 to nrUsb1.DeviceCount - 1 do begin
    Memo1.Lines.Add(
        TnrUsbDevice(nrUsb1.Device[ i ]).NameFriendly +
        ' (' + IntToHex(TnrUsbDevice(nrUsb1.Device[ i ]).VendorID,4) + ':' +
               IntToHex(TnrUsbDevice(nrUsb1.Device[ i ]).ProductID,4) + ')'
        );
  end;
end;

Good luck!

Roman

Quote
Hi Roman,
...
And a question on using the usb component.
Using the USB demo, I can see how to get the usb devices using the devicebox component. What I need to do, is cycle through the usb devices, and for each
one read the drive letters and the descriptors. Once I have this information, I will present the info to the user. I don’t want the user to have to use a
devicebox combo, as some of the devices may not be ones I want to show to the user.
How can I cycle through the devices without using a device box ?
...
 
Paul
« Last Edit: March 29, 2008, 06:19:32 am by Roman Novgorodov »
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.