我要修改一注册表的键值,路径已经确定:
(既修改,一IP地址的最后一个值)

解决方案 »

  1.   

    重写IP值呀
    RegIniFile:=TRegIniFile.Create('Software');Writes a string value to a specified data value associated with a specified key.procedure WriteString(const  Section, Ident, Value: string);DescriptionCall WriteString to store a string value in a data value associated with a specified key.Section is a string identifying the key into which to store a data value. Ident is a string identifying the name of the data value into which to write. Value is the string value to write into the data value.例子
    var RegIniFile:TRegIniFile;    
        try
         RegIniFile.WriteString(SECTION,'LOGIN_CODE',g_sUserCode);
         RegIniFile.WriteInteger(SECTION,'Height',Self.Height);
             RegIniFile.WriteInteger(SECTION,'Width',Self.Width);
             RegIniFile.WriteInteger(SECTION,'Left',Self.Left);
             RegIniFile.WriteInteger(SECTION,'Top',Self.Top);
        finally
         RegIniFile.Free;
        end;
    SECTION 是个变量
      

  2.   

    TRegistry 类也可以。
    Delphi Help:
    The following example shows how to tell Windows to relaunch your application when Windows starts up if it was running when the system shut down. When Windows starts up, it launches each application listed in the RunOnce key and then deletes the entry for that application.  Therefore, you do not need to remove the entry written here.procedure TForm1.WMEndSession(var Message: TWMEndSession);
    var
      Reg: TRegistry;
    begin
      Reg := TRegistry.Create;
      try
        Reg.RootKey := HKEY_CURRENT_USER;
        if Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\RunOnce', True)
        then Reg.WriteString('MyApp','"' + ParamStr(0) + '"');
      finally
        Reg.CloseKey;
        Reg.Free;
        inherited;
      end;
    end;In order for this method to be called, it must be declared in the interface section of your unit as follows:private  procedure WMEndSession(var Msg:TWMEndSession); message WM_ENDSESSION;
      

  3.   

    var
      RegF:TRegistry;
    begin
       RegF:=TRegistry.Create;
       RegF.OpenKey("HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Class\NetTrans\0001",TRUE);
       RegF.WriteString("IPAddress",IP);
    end;IP就是你要改的IP地址了