I have written the following function to read the registery and get the names 
of the installed comports. I want to get the names like COM1, COM2, etc, but I 
get names like \Device\Serial0, \Device\Serial1, etc. I want PortList to 
contained the wanted names. Obviously GetValueNames doesn't get the job done. 
How do I modify GetAllSerialPorts to return what I want?

Any enlightenment will be appreciated.

Vic Fraenckel

========================== function GetAllSerialPorts 
===========================


function GetAllSerialPorts(Var PortList : TStringList) : integer;

//This function reads the registery and extracts the names of
//the known serial ports on your computer.
//The function returns:
//    WICNOERROR if successful
//    WICCOMPORTERROR of an error is detected

var
  i:integer;
  itemct : integer;
  reg : TRegistry;

begin
 reg := TRegistry.Create;
  try
    begin
      reg.RootKey := HKEY_LOCAL_MACHINE;
      if not reg.KeyExists ('HARDWARE\DEVICEMAP\SERIALCOMM') then
        begin
          result := WICCOMPORTERROR;
          exit;
        end;
      if not reg.OpenKey ('HARDWARE\DEVICEMAP\SERIALCOMM',false)then
        begin
          result := WICCOMPORTERROR;
          exit;
        end
      else
        reg.GetValueNames (PortList);
    end; //try

  finally
    begin
      reg.CloseKey;
      reg.Free;
    end;
  end;
  result := WICNOERROR;

end;

________________________________________________________

Victor Fraenckel - The Windman         
victorf ATSIGN windreader DOTcom
KC2GUI                                                  



[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
<font face=arial size=-1><a 
href="http://us.ard.yahoo.com/SIG=12h23jhik/M=362131.6882499.7825260.1510227/D=groups/S=1705115362:TM/Y=YAHOO/EXP=1123442373/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