function GetNetUserName: string;
var
pcUser: PChar;
dwUSize: DWORD;
begin
dwUSize := 21; // user name can be up to 20 characters
GetMem(pcUser, dwUSize); // allocate memory for the string
try
if NO_ERROR = WNetGetUser(0, pcUser, dwUSize)
then Result := pcUser;
finally
FreeMem(pcUser);
end;
end;
Function getNetComputername : String;
Var
PcName: array[0..256] of Char;
dwUSize: DWORD;
Begin
dwUSize := 255;
if GetComputerName(PcName, dwUSize) Then
Begin
Result:=pcname;
end else
Begin
end;
end;