Delphi-PRAXiS
Seite 2 von 2     12   

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Set hostname - can't write to registry (https://www.delphipraxis.net/167564-set-hostname-cant-write-registry.html)

jaenicke 7. Apr 2012 16:43

AW: Re: Set hostname - can't write to registry
 
Zitat:

Zitat von WojTec (Beitrag 1160603)
Hm, now return True, but names are not changed after restart :(

For me it seems as if you look at the wrong position. Following the documentation only the NETBIOS name is changed by this function. This is not what you see in the system settings. :zwinker:

So you will have to follow the hint in the documentation:
Zitat:

To set the DNS host name or the DNS domain name, call the SetComputerNameEx function.
I guess you meant what SetComputerNameEx does. ;-)

WojTec 7. Apr 2012 17:06

Re: Set hostname - can't write to registry
 
I have:

Delphi-Quellcode:
// Set DNS and NetBIOS
SetComputerName(ComputerNamePhysicalDnsHostname, FHostName);
// Set NetBIOS
SetComputerName(ComputerNamePhysicalNetBIOS, FComputerName);
My SetComputerName():

Delphi-Quellcode:
function SetComputerName(const AType: TComputerNameFormat; const AName: string): Boolean;
var
  Name: array[0..MAX_COMPUTERNAME_LENGTH + 1] of Char;
begin
  StrPCopy(Name, AName);
  Result := SetComputerNameEx(AType, Name);
end;
It seems there is some strange problem with permissions...


Alle Zeitangaben in WEZ +1. Es ist jetzt 21:52 Uhr.
Seite 2 von 2     12   

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz