`get computer name` C++ Examples
9 C++ code examples are found related to "get computer name".
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
Example 1
Source File: platform.cpp From FarManager with BSD 3-Clause "New" or "Revised" License | 7 votes |
bool GetComputerName(string& Name) { wchar_t Buffer[MAX_COMPUTERNAME_LENGTH + 1]; auto Size = static_cast<DWORD>(std::size(Buffer)); if (!::GetComputerName(Buffer, &Size)) return false; Name.assign(Buffer, Size); return true; }
Example 2
Source File: juce_linux_SystemStats.cpp From MEC with GNU General Public License v3.0 | 5 votes |
String SystemStats::getComputerName() { char name [256] = { 0 }; if (gethostname (name, sizeof (name) - 1) == 0) return name; return {}; }
Example 3
Source File: juce_linux_SystemStats.cpp From JUCE-Graph-Component with MIT License | 5 votes |
String SystemStats::getComputerName() { char name [256] = { 0 }; if (gethostname (name, sizeof (name) - 1) == 0) return name; return String(); }
Example 4
Source File: juce_linux_SystemStats.cpp From Injectora with MIT License | 5 votes |
String SystemStats::getComputerName() { char name [256] = { 0 }; if (gethostname (name, sizeof (name) - 1) == 0) return name; return String(); }
Example 5
Source File: platform.cpp From FarManager with BSD 3-Clause "New" or "Revised" License | 5 votes |
bool GetComputerNameEx(COMPUTER_NAME_FORMAT NameFormat, string& Name) { return detail::ApiDynamicStringReceiver(Name, [&](span<wchar_t> Buffer) { auto Size = static_cast<DWORD>(Buffer.size()); if (!::GetComputerNameEx(NameFormat, Buffer.data(), &Size) && GetLastError() != ERROR_MORE_DATA) return 0ul; return Size; }); }
Example 6
Source File: MC_Registry.cpp From massgate with GNU General Public License v2.0 | 5 votes |
void MC_Registry::GetLocalComputerName(MC_String& aName) { aName = "UNKNOWN"; #if IS_PC_BUILD // SWFM:AW - To get the xb360 to compile HKEY rkey; char name[512]; if(::RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SYSTEM\\CurrentControlSet\\Control\\ComputerName\\ComputerName", 0, KEY_READ, &rkey) == ERROR_SUCCESS) { unsigned long d1 = sizeof(name) - 1; unsigned long d2 = REG_SZ; if (::RegQueryValueEx(rkey, "ComputerName", 0, &d2, (unsigned char*) name, &d1) == ERROR_SUCCESS) { aName = name; } RegCloseKey(rkey); } #endif }
Example 7
Source File: system_android.cpp From SLib with MIT License | 5 votes |
String System::getComputerName() { jobject jactivity = Android::getCurrentActivity(); if (jactivity) { return JAndroid::getDeviceNameOnSettings.callString(sl_null, jactivity); } return sl_null; }