delphi
type WKSTA_INFO_100 = Record wki100_platform_id : DWORD; wki100_computername : LPWSTR; wki100_langroup : LPWSTR; wki100_ver_major : DWORD; wki100_ver_minor : DWORD; end; PWKSTA_INFO_100 = ^WKSTA_INFO_100; function NetWkstaGetInfo(name: PWCHAR; Level: DWORD; buffer: Pointer): DWORD; stdcall; external 'Netapi32.dll'; function NetApiBufferFree(Buffer: Pointer): DWORD; stdcall; external 'netapi32.dll'; implementation function GetNetName(): String; var WK: PWKSTA_INFO_100; begin Result:= ''; if 0 = NetWkstaGetInfo(nil, 100, @WK) then Result:= WK.wki100_langroup; NetApiBufferFree(WK.wki100_langroup); end;
Saludos.