Programação

Como Desmarcar a Opção “Detectar automaticamente as configurações” em Configurações da LAN – Delphi

Curta Nossa Página

Desmarcando a Opção “Detectar automaticamente as configurações” em Configurações da LAN com Delphi

  • Crie um Formulário;
  • Adicione um Botão;
  • Adicione na cláusula USES:
    uses 
      Registry;
    
  • No Botão adicione o código abaixo:
procedure TForm1.BitBtn1Click(Sender: TObject);
var
    Buffer : array [0..87] of Byte;
    Reg: TRegistry;
begin
  Reg := TRegistry.Create(KEY_WRITE);
  try
    Reg.RootKey := HKEY_CURRENT_USER;
Buffer[1]  := $3c;
Buffer[2]  := $00;
Buffer[3]  := $00;
Buffer[4]  := $00;
Buffer[5]  := $1f;
Buffer[6]  := $00;
Buffer[7]  := $00;
Buffer[8]  := $00;
Buffer[9]  := $01; // Opções (Ver no Final do Código) 
Buffer[10]  := $00;
Buffer[11]  := $00;
Buffer[12]  := $00;
Buffer[13]  := $00;
Buffer[14]  := $00;
Buffer[15]  := $00;
Buffer[16]  := $00;
Buffer[17]  := $00;
Buffer[18]  := $00;
Buffer[19]  := $00;
Buffer[20]  := $00;
Buffer[21]  := $00;
Buffer[22]  := $00;
Buffer[23]  := $00;
Buffer[24]  := $00;
Buffer[25]  := $01;
Buffer[26]  := $00;
Buffer[27]  := $00;
Buffer[28]  := $00;
Buffer[29]  := $1f;
Buffer[30]  := $00;
Buffer[31]  := $00;
Buffer[32]  := $00;
Buffer[33]  := $68;
Buffer[34]  := $74;
Buffer[35]  := $74;
Buffer[36]  := $70;
Buffer[37]  := $3a;
Buffer[38]  := $2f;
Buffer[39]  := $2f;
Buffer[40]  := $31;
Buffer[41]  := $34;
Buffer[42]  := $34;
Buffer[43]  := $2e;
Buffer[44]  := $31;
Buffer[45]  := $33;
Buffer[46]  := $31;
Buffer[47]  := $2e;
Buffer[48]  := $32;
Buffer[49]  := $32;
Buffer[50]  := $32;
Buffer[51]  := $2e;
Buffer[52]  := $31;
Buffer[53]  := $36;
Buffer[54]  := $37;
Buffer[55]  := $2f;
Buffer[56]  := $77;
Buffer[57]  := $70;
Buffer[58]  := $61;
Buffer[59]  := $64;
Buffer[60]  := $2e;
Buffer[61]  := $64;
Buffer[62]  := $61;
Buffer[63]  := $74;
Buffer[64]  := $90;
Buffer[65]  := $0e;
Buffer[66]  := $1e;
Buffer[67]  := $66;
Buffer[68]  := $d3;
Buffer[69]  := $88;
Buffer[70]  := $c5;
Buffer[71]  := $01;
Buffer[72]  := $01;
Buffer[73]  := $00;
Buffer[74]  := $00;
Buffer[75]  := $00;
Buffer[76]  := $8d;
Buffer[77]  := $a8;
Buffer[78]  := $4e;
Buffer[79]  := $9e;
Buffer[80]  := $00;
Buffer[81]  := $00;
Buffer[82]  := $00;
Buffer[83]  := $00;
Buffer[84]  := $00;
Buffer[85]  := $00;
Buffer[86]  := $00;
Buffer[87]  := $00;

    Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections', True);
    Reg.WriteBinaryData('DefaultConnectionSettings', Buffer[1], SizeOf(Buffer));
  finally
    Reg.Free;
  end;
// Aviso
if MessageBox(Handle, 'Definido com Sucesso!', 'Aviso',
MB_OK or MB_ICONINFORMATION) = IDOK then
end;

Opções:

Buffer[9] := $09; // Marca a Opção “Detectar automaticamente as configurações”
Buffer[9] := $01; // Desmarca a Opção “Detectar automaticamente as configurações”
Buffer[9] := $0d; // Marca as Opções “Detectar automaticamente as configurações” e “Usar script de configuração automática”

Etiquetas
Botão Voltar ao topo
Fechar