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:
@@ -127,13 +127,19 @@ static const wxChar eUSERNAME[] = wxT("UserName");
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
// Get hostname only (without domain name)
|
// Get hostname only (without domain name)
|
||||||
bool wxGetHostName(wxChar *WXUNUSED_IN_WINCE(buf),
|
bool wxGetHostName(wxChar *buf, int maxSize)
|
||||||
int WXUNUSED_IN_WINCE(maxSize))
|
|
||||||
{
|
{
|
||||||
#if defined(__WXWINCE__)
|
#if defined(__WXWINCE__)
|
||||||
// TODO-CE
|
// GetComputerName() is not supported but the name seems to be stored in
|
||||||
return false;
|
// this location in the registry, at least for PPC2003 and WM5
|
||||||
#else
|
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;
|
DWORD nSize = maxSize;
|
||||||
if ( !::GetComputerName(buf, &nSize) )
|
if ( !::GetComputerName(buf, &nSize) )
|
||||||
{
|
{
|
||||||
@@ -141,9 +147,9 @@ bool wxGetHostName(wxChar *WXUNUSED_IN_WINCE(buf),
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif // __WXWINCE__/!__WXWINCE__
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// get full hostname (with domain name if possible)
|
// get full hostname (with domain name if possible)
|
||||||
|
Reference in New Issue
Block a user