Thursday, December 14, 2017

DELPHI - How get computer name

function My_GetComputerName : string;
var
  buffer : array[ 0..255 ] of char;
  i      : dword;
begin
  fillChar( buffer, sizeof( buffer ), #0 );
  i := sizeof( buffer );
  GetComputerName( @buffer, i );
  result := strPas( Buffer );
end;
When you call it:
ShowMessage( My_GetComputerName );
Output could be:

No comments:

Post a Comment