标签:blog http color io for 2014 cti div
//
function GetUser: string; //获取本机当前用户名
var
Buffer: array[0..255] of Char;
Size: cardinal;
begin
Size :=
256;
if
GetUserName(Buffer, Size) then
begin
Result := Buffer
end
else
begin
Result := ‘Unknown‘
end;
end;
function GetComputerName: string;//获取计算机名
var
buffer: array[0..MAX_COMPUTERNAME_LENGTH +
1] of
Char;
Size: Cardinal;
begin
Size := MAX_COMPUTERNAME_LENGTH +
1;
Windows.GetComputerName(@buffer,
Size);
Result :=
StrPas(buffer);
end;
//显示信息
procedure
TForm1.FormCreate(Sender: TObject);
begin
Edit1.Text := GetUser;
Edit2.Text := GetComputerName;
end;
标签:blog http color io for 2014 cti div
原文地址:http://www.cnblogs.com/xe2011/p/3876205.html