🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.delphi.nativeapi
Article #12168

Re: Enumports

#12168
From: Peter Below (TeamB)
Date: Fri, 22 Nov 2002 18:43
33 lines
1963 bytes
In article <3dde241e@newsgroups.borland.com>, Carlos Azevedo wrote:
> How to use the function Enumports to discover if the LPT1 port is install?

uses winspool;

procedure TForm1.Button1Click(Sender: TObject);
var
  pInfo, pScan: PPortInfo1;
  bytesNeeded, items, i: DWORD;
begin
  EnumPorts( nil, 1, nil, 0, bytesNeeded, items );
  GetMem( pInfo, bytesNeeded );
  try
    Win32Check( 
      EnumPorts( nil, 1, pInfo, bytesNeeded, bytesNeeded, items ));
    pScan := pInfo;
    For i:= 0 To items-1 Do Begin
      memo1.lines.add( pScan^.pName );
      Inc( pScan );
    End;
  finally
    FreeMem( pInfo );
  end;
end;


--
Peter Below (TeamB)  
Use the newsgroup archives :
http://www.mers.com/searchsite.html
http://www.tamaracka.com/search.htm
http://groups.google.com
http://www.prolix.be
Technical Details
Message-ID: <VA.00009668.0086597a@antispam.compuserve.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-06!sn-xit-04!supernews.com!news.maxwell.syr.edu!newshosting.com!news-xfer1.atl.newshosting.com!64.154.60.99.MISMATCH!c02.atl3!news.webusenet.com!ngpeer.news.aol.com!newsfeed1.cidera.com!Cidera!news.uni-x.net!newsgroups.borland.com!not-for-mail
References: <3dde241e@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f94dd,e4085bbbbd7e21cd
X-Google-Attributes: gidf94dd,public
X-Google-ArrivalTime: 2002-11-22 11:16:00 PST
Date: Fri, 22 Nov 2002 19:43:35 +0100
Newsgroups: borland.public.delphi.nativeapi
Mime-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
X-Newsreader: Virtual Access by Atlantic Coast PLC, http://www.atlantic-coast.com/va
Organization: TeamB
Message-ID: <VA.00009668.0086597a@antispam.compuserve.com>
Subject: Re: Enumports
From: "Peter Below (TeamB)" <100113.1101@compuXXserve.com>
Reply-To: 100113.1101@compuXXserve.com
References: <3dde241e@newsgroups.borland.com>
NNTP-Posting-Host: 62.226.189.68
X-Trace: newsgroups.borland.com 1037990604 62.226.189.68 (22 Nov 2002 10:43:24 -0800)
Lines: 35
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-06!sn-xit-04!supernews.com!news.maxwell.syr.edu!newshosting.com!news-xfer1.atl.newshosting.com!64.154.60.99.MISMATCH!c02.atl3!news.webusenet.com!ngpeer.news.aol.com!newsfeed1.cidera.com!Cidera!news.uni-x.net!newsgroups.borland.com!not-for-mail