The SetComputerName function sets the computer name to be used the next time the system is restarted.
BOOL SetComputerName(
LPCTSTR lpComputerName // address of new computer name
);
Windows 95: If this string contains one or more characters that are outside the standard character set, those characters are coerced into standard characters.
Windows NT: If this string contains one or more characters that are outside the standard character set, SetComputerName returns ERROR_INVALID_PARAMETER. It does not coerce the characters outside the standard set.
The standard character set includes letters, numbers, and the following symbols: ! @ # $ % ^ & ' ) ( . - _ { } ~ .
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Applications using this function must have administrator rights.
Windows NT: Requires version 3.1 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in winbase.h.
Import Library: Use kernel32.lib.
Unicode: Implemented as Unicode and ANSI versions on Windows NT.
System Information Overview, System Information Functions, GetComputerName