请大家给个下面API的例子:
BOOL GetComputerName( LPTSTR lpBuffer, // address of name buffer
LPDWORD nSize // address of size of name buffer
);struct hostent FAR * gethostbyaddr ( const char FAR * addr,
int len,
int type
);
struct hostent FAR * gethostbyname ( const char FAR * name
);
BOOL GetComputerName( LPTSTR lpBuffer, // address of name buffer
LPDWORD nSize // address of size of name buffer
);struct hostent FAR * gethostbyaddr ( const char FAR * addr,
int len,
int type
);
struct hostent FAR * gethostbyname ( const char FAR * name
);
pComputerName:Pchar;
begin
GetMem(pComputerName,255);
try
Size:=250;
if GetComputerName(pComputerName,Size)=true then
finally
FreeMem(pComputername);
end;