Forum: Object-Pascal / Delphi-Language
Delphi
by WojTec,
7. Apr 2012
I have:
// Set DNS and NetBIOS
SetComputerName(ComputerNamePhysicalDnsHostname, FHostName);
// Set NetBIOS
SetComputerName(ComputerNamePhysicalNetBIOS, FComputerName);
My SetComputerName():
function SetComputerName(const AType: TComputerNameFormat; const AName: string): Boolean;
Forum: Object-Pascal / Delphi-Language
Delphi
by WojTec,
7. Apr 2012
Hm, now return True, but names are not changed after restart :(
Forum: Object-Pascal / Delphi-Language
Delphi
by WojTec,
6. Apr 2012
I don't understand what you mean. What I should to do to make it working?
Forum: Object-Pascal / Delphi-Language
Delphi
by WojTec,
5. Apr 2012
// ShowMessage(BoolToStr(SetComputerName('TTX'), True));
// ShowMessage(SysErrorMessage(GetLastError));
// Set computer name and host name
ShowMessage(BoolToStr(SetComputerNameEx(ComputerNamePhysicalDnsHostname, 'TTX-N'), True));
// Set computer name
ShowMessage(BoolToStr(SetComputerNameEx(ComputerNamePhysicalNetBIOS, 'TTX'), True));
Forum: Object-Pascal / Delphi-Language
Delphi
by WojTec,
5. Apr 2012
I have admin rights.
Last error looks to be success, but SetComputerName and SetComputerNameEx returns false.
Forum: Object-Pascal / Delphi-Language
Delphi
by WojTec,
5. Apr 2012
I'm trying change host name (like My Computer properties --> Computer Name).
I did this:
if OpenKey('SYSTEM\CurrentControlSet\services\Tcpip\Parameters', True) then
try
WriteString('NV Hostname', FHostName);
WriteString('Hostname', FHostName);
finally
CloseKey;