/////////////////////////////////////////////////////////////////////////////
-// Name: msw/utils.cpp
+// Name: src/msw/utils.cpp
// Purpose: Various utilities
// Author: Julian Smart
// Modified by:
// ----------------------------------------------------------------------------
// In the WIN.INI file
+#if (!defined(USE_NET_API) && !defined(__WXWINCE__)) || defined(__WXMICROWIN__)
static const wxChar WX_SECTION[] = wxT("wxWindows");
+#endif
+
+#if (!defined(USE_NET_API) && !defined(__WXWINCE__))
static const wxChar eUSERNAME[] = wxT("UserName");
+#endif
// ============================================================================
// implementation
// Can't assume we have NIS (PC-NFS) or some other ID daemon
// So we ...
- if ( (user = wxGetenv(wxT("USER"))) == NULL &&
- (user = wxGetenv(wxT("LOGNAME"))) == NULL )
+ if ( (user = wxGetenv(wxT("USER"))) == NULL &&
+ (user = wxGetenv(wxT("LOGNAME"))) == NULL )
{
// Use wxWidgets configuration data (comming soon)
GetProfileString(WX_SECTION, eUSERID, default_id, buf, maxSize - 1);
}
// Get user name e.g. Julian Smart
-bool wxGetUserName(wxChar *WXUNUSED_IN_WINCE(buf),
- int WXUNUSED_IN_WINCE(maxSize))
+bool wxGetUserName(wxChar *buf, int maxSize)
{
+ wxCHECK_MSG( buf && ( maxSize > 0 ), false,
+ _T("empty buffer in wxGetUserName") );
#if defined(__WXWINCE__)
- // TODO-CE
- return false;
+ wxRegKey key(wxRegKey::HKCU, wxT("Control Panel\\Owner\\Owner"));
+ if(!key.Open(wxRegKey::Read))
+ return false;
+ wxString name;
+ if(!key.QueryValue(wxEmptyString, name))
+ return false;
+ wxStrncpy(buf, name.c_str(), maxSize);
+ return true;
#elif defined(USE_NET_API)
CHAR szUserName[256];
if ( !wxGetUserId(szUserName, WXSIZEOF(szUserName)) )
lpfProcess32First = NULL;
lpfProcess32Next = NULL;
+#if wxUSE_DYNLIB_CLASS
+
wxDynamicLibrary dllKernel(_T("kernel32.dll"), wxDL_VERBATIM);
// Get procedure addresses.
lpfProcess32Next =
(Process32_t)dllKernel.RawGetSymbol(_T("Process32Next"));
+
+#endif // wxUSE_DYNLIB_CLASS
}
// By John Skiff
return hwnd;
}
-