Implement wxGetHostName() for Windows CE.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61507 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-07-23 17:31:06 +00:00
parent 89d62794e4
commit 32cdc45397

View File

@@ -127,13 +127,19 @@ static const wxChar eUSERNAME[] = wxT("UserName");
// ----------------------------------------------------------------------------
// Get hostname only (without domain name)
bool wxGetHostName(wxChar *WXUNUSED_IN_WINCE(buf),
int WXUNUSED_IN_WINCE(maxSize))
bool wxGetHostName(wxChar *buf, int maxSize)
{
#if defined(__WXWINCE__)
// TODO-CE
return false;
#else
// GetComputerName() is not supported but the name seems to be stored in
// this location in the registry, at least for PPC2003 and WM5
wxString hostName;
wxRegKey regKey(wxRegKey::HKLM, wxT("Ident"));
if ( !regKey.HasValue(wxT("Name")) ||
!regKey.QueryValue(wxT("Name"), hostName) )
return false;
wxStrlcpy(buf, hostName.wx_str(), maxSize);
#else // !__WXWINCE__
DWORD nSize = maxSize;
if ( !::GetComputerName(buf, &nSize) )
{
@@ -141,9 +147,9 @@ bool wxGetHostName(wxChar *WXUNUSED_IN_WINCE(buf),
return false;
}
#endif // __WXWINCE__/!__WXWINCE__
return true;
#endif
}
// get full hostname (with domain name if possible)