拨号设置

unit Unit1;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls,Registry,ShlObj;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

buffer : Array[0..86] of Byte = ($46, $00, $00, $00, $01, $00, $00, $00, $05, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $1f, $00, $00, $00, $68, $74, $74, $70, $3a, $2f, $2f, $31, $32, $37, $2e, $30, $2e, $30, $2e, $31, $3a, $38, $30, $38, $36, $2f, $70, $72, $6f, $78, $79, $2e, $70, $61, $63, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00, $00);

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  reg:tregistry;
begin
   reg:=tregistry.Create;
        reg.RootKey:=HKEY_CURRENT_USER;
        REG.OpenKey('SOFTWAREMicrosoftWindowsCurrentVersionInternet SettingsConnections',true) ;
        Reg.WriteBinaryData('宽带连接', buffer[0], Length(buffer));
        SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, nil, nil); //立刻更新
        reg.CloseKey;
        reg.Free;
end;

end.

原文地址:https://www.cnblogs.com/onionhacker/p/3538264.html