From: Robert Scharen Subject: Re: How can I get a list of COM and LPT ports ? Date: 26 May 2000 00:00:00 GMT Message-ID: <392EDFB8.A8F5DA34@brandentech-nospam.com> Content-Transfer-Encoding: 8bit References: <8ggedm$gn812@bornews.borland.com> X-Accept-Language: en Content-Type: text/plain; charset=iso-8859-1 X-Trace: 26 May 2000 13:25:21 -0800, 206.173.174.46 MIME-Version: 1.0 Newsgroups: borland.public.delphi.winapi "Jerry Adriane Gonçalves" wrote: > Hi, > settle > I need populate a combobox with machine´s COM ports and other combobox with > machine´s LPT ports. > Is there an way to do this ? Can anyone help me ? > > Thanks in advance. > > Jerry - Brazil The following procedure will list all the devices on your computer. You can then extract the com ports and printer ports by looking for the 'COM' and 'LPT' characters in the list. procedure TForm1.Button1Click(Sender: TObject); var istr: string; isize, i: dword; begin setlength(istr, 4000); isize := QueryDosDevice(nil, @istr[1], 4000); for i := 1 to isize do if istr[i] = #0 then istr[i] := #10; memo1.lines.CommaText := istr; end; HTH Robert Scharen Branden Technologies