function MaxCommPorts: Integer;
begin
  if Win32PlatForm = VER_PLATFORM_WIN32_NT then
    Result := 256
  else { if VER_PLATFORM_WIN32_WINDOWS }
    Result := 9;
end;

procedure EnumCommPorts(PortList: TStrings; Prefix: String = '');
var
  n: integer;
  Port: THandle;
  PortName: string;
begin
  for n := 1 to MaxCommPorts do
  begin
    PortName := '\\.\COM' + IntToStr(n);
    Port := CreateFile(PChar(PortName), GENERIC_READ or GENERIC_WRITE,
0, nil, OPEN_EXISTING, 0, 0);
    if (Port <> INVALID_HANDLE_VALUE) or (GetLastError =
ERROR_ACCESS_DENIED) then
      PortList.Add(Prefix + IntToStr(n));
    CloseHandle(Port);
  end;
end;






------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a 
href="http://us.ard.yahoo.com/SIG=12htnnk9f/M=362131.6882499.7825260.1510227/D=groups/S=1705115362:TM/Y=YAHOO/EXP=1123446073/A=2889191/R=0/SIG=10r90krvo/*http://www.thebeehive.org
">Get Bzzzy! (real tools to help you find a job) Welcome to the Sweet Life 
- brought to you by One Economy</a>.</font>
--------------------------------------------------------------------~-> 

-----------------------------------------------------
Home page: http://groups.yahoo.com/group/delphi-en/
To unsubscribe: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/delphi-en/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to