对于注册表中的  REG_MULTI_SZ  这种多重字符串类型的数据如何读/写 (我是想修改HKEY_LOCAL_MACHINE下的   system\currentcontrolset\services\{.....}\parameters\Topic 中的defaultgateway的值)请各位高手不吝赐教!!!

解决方案 »

  1.   

    属于二进制数据。用 ReadBinaryData 来完成。
      

  2.   

    Var Reg : TRegistry; 
        list : TStrings; 
        i    : Integer; 
    Begin 
     Reg:=TRegistry.Create; 
     Reg.RootKey:='HKEY_LOCAL_MACHINE'; 
     If Reg.OpenKey('\Software\Microsoft\CurrentVersion\Run', false) then 
      Begin 
       List:=TStringList.Create; 
       Reg.GetValueNames(List); 
       For i:=0 to list.Count-1 do 
        If Reg.ValueExists(List[i]) then 
         Begin 
          Case Reg.GetDataType(List[i]) of 
           rdInteger: Reg.ReadInteger(List[i]); 
           rdBinary: Reg.ReadBinaryData(List[i]); 
          else  
            Reg.ReadString(List[i]); 
          End;   
         End; 
      End; 
    End; 
    这个程序可以获得注册表下的全部值