Author Topic: Device Count is ZERO  (Read 2466 times)

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Device Count is ZERO
« on: January 31, 2008, 09:58:33 am »
Developer asks:

I need to set the modem for the TAPI part of my application. I have my own
dialog and can't use your device box. So I attempted to retrieve
modems via Device, DeviceCount etc. According to Help, this list is
populated at nrCommTAPI constructor time. The DeviceCount is zero.
In addition is there an easier way to set the modem strictly based on it's
friendly name instead of searching for the name and using the index ?

Thanks
Bill

procedure TForm1.FormShow(Sender: TObject);
var
  j: integer;
begin
  with nrCommTAPI1 do
  begin
    Memo1.Lines.Clear;
    for j := 0 to DeviceCount - 1 do
      Memo1.Lines.Add(Device[j].NameFriendly);
  end;
end;
« Last Edit: January 31, 2008, 10:05:16 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.

Roman Novgorodov

  • Engineer
  • Administrator
  • Hero Member
  • *****
  • Posts: 994
  • we will win
    • View Profile
    • Forums.nrCommLib.Com
Re: Device Count is ZERO
« Reply #1 on: January 31, 2008, 10:02:03 am »
You can call Update() method for reload Device List. See modified code:

procedure TForm1.FormShow(Sender: TObject);
var
  j: integer;
begin
  nrCommTAPI1.Update;
  with nrCommTAPI1 do
  begin
    Memo1.Lines.Clear;
    for j := 0 to DeviceCount - 1 do
      Memo1.Lines.Add(Device[j].NameFriendly);
  end;
end;
« Last Edit: January 31, 2008, 10:04:56 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.