Click to See Complete Forum and Search --> : Computer name in the registry?


sarambur
March 25th, 2003, 11:59 AM
where can i find my Computer's name in the registry?

Or, what is the API function to get the name?


Thanks!

ovidiucucu
March 25th, 2003, 12:29 PM
DWORD dwSize = MAX_COMPUTERNAME_LENGTH + 1;
LPTSTR pszName = new TCHAR[dwSize];
BOOL bRet = ::GetComputerName( pszName, &dwSize );
delete []pszName;

ovidiucucu
March 25th, 2003, 12:35 PM
Also see
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName
in the registry