Einzelnen Beitrag anzeigen

Basilikum

Registriert seit: 9. Aug 2003
389 Beiträge
 
Delphi 7 Professional
 
#7

Re: Den richtigen Computernamen ändern

  Alt 30. Mai 2006, 19:37
Zitat von RWarnecke:
Und wie wende ich ich jetzt den Befehl SetComputerNameEx im Delphi an ?
diese API ist in der Windows.pas nicht enthalten - demnach selber importieren:
Delphi-Quellcode:
Const
  kernel32 = 'kernel32.dll';

Type
  COMPUTER_NAME_FORMAT = (
                                     ComputerNameNetBIOS,
                                     ComputerNameDnsHostname,
                                     ComputerNameDnsDomain,
                                     ComputerNameDnsFullyQualified,
                                     ComputerNamePhysicalNetBIOS,
                                     ComputerNamePhysicalDnsHostname,
                                     ComputerNamePhysicalDnsDomain,
                                     ComputerNamePhysicalDnsFullyQualified,
                                     ComputerNameMax
                                    );


Function GetComputerNameEx
                                  (
                                    NameType : COMPUTER_NAME_FORMAT;
                                    lpBuffer : PChar;
                                    Var lpnSize : DWORD
                                  ) : BOOL; StdCall; External kernel32 Name 'GetComputerNameExA';

Function SetComputerNameEx
                                  (
                                    NameType : COMPUTER_NAME_FORMAT;
                                    lpBuffer : PChar
                                  ) : BOOL; StdCall; External kernel32 Name 'SetComputerNameExA';

Procedure ???
Begin
  SetComputerNameEx(ComputerNamePhysicalDnsHostname,'Globi');
end;
  Mit Zitat antworten Zitat