Код:
Label1.Caption := gName(1); // Get the computer name.
Label2.Caption := gName(2); // Get the user name
Код:
uses
Windows;
function gName( iInput: Integer ): String;
var
Size:Cardinal;
cBuff: array[0..260] of Char;
begin
Size := 260;
ZeroMemory( @cBuff[0], Size );
case iInput of
1: GetComputerName(cBuff, Size);
2: GetUserName(cBuff, Size);
end;
Result := cBuff;
end;
Использование:
Код:
Label1.Caption := gName(1); // Get the computer name.
Label2.Caption := gName(2); // Get the user name