• Welcome to Forum.Deepsoftware.Com. Please login or sign up.
 

How to enumerate without TnrDeviceBox ?

Started by ChrBlack, October 28, 2009, 01:14:18 pm

Previous topic - Next topic

ChrBlack

October 28, 2009, 01:14:18 pm Last Edit: October 28, 2009, 01:25:04 pm by ChrBlack
Hello!

I have a problem with handling HID devices in Delphi 2007. I've noticed that i can't use nrHID without nrDeviceBox.
For examlple if i put nrHid1 object into the form and call nrHid1.DeviceCount then it returns zero.
But if i put nrDeviceBox1 object and nrHid1 and set nrDeviceBox1.nrComm property to nrHid1 then nrHid1.DeviceCount returns the valid value.

My problem is i don't want to use TnrDeviceBox because i will never use it but it seems i can't enumerate devices without it. Another problem that i need to write a class (in a simple unit.pas) for handling several devices and i want to create objects dinamically in the constructor of the class. The problem is nrDeviceBox derived from ComboBox and it needs a parent window (i get an error message like "...Control has no parent window" error).

Some code from the constructor of my class (nrHid1 and nrDeviceBox1 are private variables of the class)
nrHid1:=TnrHid.Create(nil);
nrDeviceBox1:=TnrDeviceBox.Create(nil);
nrDeviceBox1.nrComm:=nrHid1;


The error what i described above pops up at the third line.



Roman Novgorodov

Hello

Pleas try to update device list before access to it:

nrHid1:=TnrHid.Create(nil);
nrHid1.Update();


Roman Novgorodov
DeepSoftware llc - The professional components for Delphi/CBuilder/.NET. The high quality custom software development.
Forums.nrCommLib.Com - DeepSoftware Tech Support Forum.

ChrBlack

Hello Roman!

It works! Thank you very much. I owe you with a mug of beer ;-)