DNS adresi değiştirme

Delphi'de kod yazma ile ilgili sorularınızı bu foruma yazabilirsiniz.
Cevapla
Kullanıcı avatarı
altunway
Üye
Mesajlar: 217
Kayıt: 11 Haz 2003 09:16
Konum: İstanbul
İletişim:

DNS adresi değiştirme

Mesaj gönderen altunway »

S.A Arkadaslar bir sorunum var

windows 2000 professional yuklu bir makinemin Tercih Edilen DNS sunucu adresini Delphi ile nasıl değiştirebilirim ?

Bununla ilgili daha once çalışma yaptınız mı ?

İlgilendiginiz için çok tşk ederim..
DotCom
Kıdemli Üye
Mesajlar: 1696
Kayıt: 11 Tem 2003 10:30
Konum: İzmir
İletişim:

Mesaj gönderen DotCom »

If you have a need to dynamically change your DNS servers from your program, you can do so by calling the the following "SetTCPIPDNSAddresses()" function with a list of DNS IP addresses separated by a single space.

uses Registry;

procedure
SaveStringToRegistry_LOCAL_MACHINE(
sKey, sItem, sVal : string );
var
reg : TRegIniFile;
begin
reg := TRegIniFile.Create( '' );
reg.RootKey := HKEY_LOCAL_MACHINE;
reg.WriteString(
sKey, sItem, sVal + #0 );
reg.Free;
end;
Listing #1 : Delphi code. Download registry (0.3 KB).

procedure
SetTCPIPDNSAddresses(
sIPs : string );
begin
//
// if using Windows NT
//
SaveStringToRegistry_LOCAL_MACHINE(
'SYSTEMCurrentControlSet' +
'ServicesTcpipParameters',
'NameServer',
sIPs );

//
// if using Windows 95
//
SaveStringToRegistry_LOCAL_MACHINE(
'SYSTEMCurrentControlSet' +
'ServicesVxDMSTCP',
'NameServer',
sIPs );
end;
Listing #2 : Delphi code. Download setdns (0.33 KB).

For example, if you want to set two DNS server addresses -- 1.2.3.4 and 5.6.7.8 here's how your function call would look like:

SetTCPIPDNSAddresses(
'1.2.3.4 5.6.7.8' );
Listing #3 : Delphi code. Download sample (0.17 KB).

Applicable Keywords : Delphi, Delphi 2.x, Delphi 3.x, Functions, Networking, Windows NT, Windows NT 3.x, Windows NT 4.x, Windows, Win32, Windows 95
Umarım işini görür...

Kolay Gelsin
pakv
Üye
Mesajlar: 65
Kayıt: 05 Haz 2013 08:59

Re: DNS adresi değiştirme

Mesaj gönderen pakv »

arkadaşlar bu kodları nasıl kullanabiliriz editlere dns girerek buton yardımı kaydettirebiliriz win7 ve xp çalışırmı kodlar...
Cevapla