BOOL GetComputerName(lpszName, lpcchBuffer); | |||||
LPTSTR lpszName; | /* address of name buffer | */ | |||
LPDWORD lpcchBuffer; | /* pointer to size of name buffer in characters | */ |
The GetComputerName function obtains the computer name of the current system. This name is established at system boot time where it is initialized from the registry.
lpszName
Points to a buffer that receives the null-terminated character string containing the computer name.
lpcchBuffer
Points to a variable that specifies the maximum size (in characters) of the buffer. This value should be large enough to contain MAX_COMPUTERNAME_LENGTH characters to allow sufficient room in the buffer for the computer name.
If the function is successful, the return value is TRUE and the variable at lpcchBuffer contains the number of characters copied to lpszName, not including the terminating null character.
If an error occurs, the return value is FALSE. To obtain extended error information, use the GetLastError function.
SetComputerName