// Created: 04/01/98
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWidgets licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
// ----------------------------------------------------------------------------
// In the WIN.INI file
-static const wxChar WX_SECTION[] = wxT("wxWidgets");
+static const wxChar WX_SECTION[] = wxT("wxWindows");
static const wxChar eUSERNAME[] = wxT("UserName");
// ============================================================================
bool wxGetHostName(wxChar *buf, int maxSize)
{
#if defined(__WXWINCE__)
- return FALSE;
+ return false;
#elif defined(__WIN32__) && !defined(__WXMICROWIN__)
DWORD nSize = maxSize;
if ( !::GetComputerName(buf, &nSize) )
{
wxLogLastError(wxT("GetComputerName"));
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
#else
wxChar *sysname;
const wxChar *default_host = wxT("noname");
} else
wxStrncpy(buf, sysname, maxSize - 1);
buf[maxSize] = wxT('\0');
- return *buf ? TRUE : FALSE;
+ return *buf ? true : false;
#endif
}
{
wxStrncpy(buf, host, maxSize);
- return TRUE;
+ return true;
}
}
}
bool wxGetUserId(wxChar *buf, int maxSize)
{
#if defined(__WXWINCE__)
- return FALSE;
+ return false;
#elif defined(__WIN32__) && !defined(__WXMICROWIN__)
DWORD nSize = maxSize;
if ( ::GetUserName(buf, &nSize) == 0 )
if ( res == 0 )
{
// not found
- return FALSE;
+ return false;
}
}
- return TRUE;
+ return true;
#else // __WXMICROWIN__
wxChar *user;
const wxChar *default_id = wxT("anonymous");
wxStrncpy(buf, user, maxSize - 1);
}
- return *buf ? TRUE : FALSE;
+ return *buf ? true : false;
#endif
}
bool wxGetUserName(wxChar *buf, int maxSize)
{
#if defined(__WXWINCE__)
- return FALSE;
+ return false;
#elif defined(USE_NET_API)
CHAR szUserName[256];
if ( !wxGetUserId(szUserName, WXSIZEOF(szUserName)) )
- return FALSE;
+ return false;
// TODO how to get the domain name?
CHAR *szDomain = "";
WideCharToMultiByte( CP_ACP, 0, ui2->usri2_full_name, -1,
buf, maxSize, NULL, NULL );
- return TRUE;
+ return true;
error:
wxLogError(wxT("Couldn't look up full user name."));
- return FALSE;
+ return false;
#else // !USE_NET_API
// Could use NIS, MS-Mail or other site specific programs
// Use wxWidgets configuration data
}
#endif // Win32/16
- return TRUE;
+ return true;
}
const wxChar* wxGetHomeDir(wxString *pstr)
bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
{
#ifdef __WXWINCE__
- return FALSE;
+ return false;
#else
if ( path.empty() )
- return FALSE;
+ return false;
// old w32api don't have ULARGE_INTEGER
#if defined(__WIN32__) && \
{
wxLogLastError(_T("GetDiskFreeSpaceEx"));
- return FALSE;
+ return false;
}
// ULARGE_INTEGER is a union of a 64 bit value and a struct containing
{
wxLogLastError(_T("GetDiskFreeSpace"));
- return FALSE;
+ return false;
}
wxLongLong lBytesPerCluster = lSectorsPerCluster;
}
}
- return TRUE;
+ return true;
#endif
// __WXWINCE__
}
bool wxGetEnv(const wxString& var, wxString *value)
{
#ifdef __WXWINCE__
- return FALSE;
+ return false;
#else // Win32
// first get the size of the buffer
DWORD dwRet = ::GetEnvironmentVariable(var, NULL, 0);
if ( !dwRet )
{
// this means that there is no such variable
- return FALSE;
+ return false;
}
if ( value )
dwRet);
}
- return TRUE;
+ return true;
#endif // WinCE/32
}
{
wxLogLastError(_T("SetEnvironmentVariable"));
- return FALSE;
+ return false;
}
- return TRUE;
+ return true;
#else // no way to set env vars
- return FALSE;
+ return false;
#endif
}
return -1;
}
- bool ok = TRUE;
+ bool ok = true;
switch ( sig )
{
case wxSIGKILL:
*krc = wxKILL_ERROR;
}
- ok = FALSE;
+ ok = false;
}
break;
{
wxLogLastError(_T("EnumWindows"));
- ok = FALSE;
+ ok = false;
}
}
else // no windows for this PID
*krc = wxKILL_ERROR;
}
- ok = FALSE;
+ ok = false;
}
}
}
// Execute a program in an Interactive Shell
bool wxShell(const wxString& command)
{
+ wxString cmd;
+
#ifdef __WXWINCE__
- return FALSE;
+ cmd = command;
#else
wxChar *shell = wxGetenv(wxT("COMSPEC"));
if ( !shell )
shell = (wxChar*) wxT("\\COMMAND.COM");
- wxString cmd;
if ( !command )
{
// just the shell
// pass the command to execute to the command processor
cmd.Printf(wxT("%s /c %s"), shell, command.c_str());
}
+#endif
return wxExecute(cmd, wxEXEC_SYNC) == 0;
-#endif
}
// Shutdown or reboot the PC
bool wxShutdown(wxShutdownFlags wFlags)
{
#ifdef __WXWINCE__
- return FALSE;
+ return false;
#elif defined(__WIN32__)
- bool bOK = TRUE;
+ bool bOK = true;
if ( wxGetOsVersion(NULL, NULL) == wxWINDOWS_NT ) // if is NT or 2K
{
default:
wxFAIL_MSG( _T("unknown wxShutdown() flag") );
- return FALSE;
+ return false;
}
bOK = ::ExitWindowsEx(flags, 0) != 0;
// sleep functions
// ----------------------------------------------------------------------------
-void wxUsleep(unsigned long milliseconds)
+void wxMilliSleep(unsigned long milliseconds)
{
::Sleep(milliseconds);
}
+void wxMicroSleep(unsigned long microseconds)
+{
+ wxMilliSleep(microseconds/1000);
+}
+
void wxSleep(int nSecs)
{
- wxUsleep(1000*nSecs);
+ wxMilliSleep(1000*nSecs);
}
// ----------------------------------------------------------------------------
if ( !name )
return -1;
- wxFontEncoding enc = wxFontMapper::Get()->CharsetToEncoding(name, FALSE);
+ wxFontEncoding enc = wxFontMapper::Get()->CharsetToEncoding(name, false);
if ( enc == wxFONTENCODING_SYSTEM )
return -1;