Forum.Deepsoftware.Com

DeepSoftware Products => nrComm Lib VCL (32bit / 64bit) => nrComm Lib => Data modems (TAPI) => Topic started by: Roman Novgorodov on January 31, 2008, 09:58:33 AM

Title: Device Count is ZERO
Post by: Roman Novgorodov 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;
Title: Re: Device Count is ZERO
Post by: Roman Novgorodov 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;