#include "wx/msw/private.h" // includes <windows.h>
#include "wx/msw/missing.h" // CHARSET_HANGUL
-#ifdef __GNUWIN32_OLD__
+#if defined(__GNUWIN32_OLD__) || defined(__WXWINCE__)
// apparently we need to include winsock.h to get WSADATA and other stuff
// used in wxGetFullHostName() with the old mingw32 versions
#include <winsock.h>
#include "wx/timer.h"
-#if !defined(__GNUWIN32__) && !defined(__SALFORDC__) && !defined(__WXMICROWIN__)
+#if !defined(__GNUWIN32__) && !defined(__SALFORDC__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
#include <direct.h>
#ifndef __MWERKS__
#include <lm.h>
#endif // USE_NET_API
-#if defined(__WIN32__) && !defined(__WXMICROWIN__)
+#if defined(__WIN32__) && !defined(__WXMICROWIN__) && !defined(__WXWINCE__)
#ifndef __UNIX__
#include <io.h>
#endif
#endif
#endif
-// ----------------------------------------------------------------------------
-// module globals
-// ----------------------------------------------------------------------------
-
-#if wxUSE_ON_FATAL_EXCEPTION
- static bool gs_handleExceptions = FALSE;
-#endif
-
// ----------------------------------------------------------------------------
// constants
// ----------------------------------------------------------------------------
// Get hostname only (without domain name)
bool wxGetHostName(wxChar *buf, int maxSize)
{
-#if defined(__WIN32__) && !defined(__WXMICROWIN__)
+#if defined(__WXWINCE__)
+ return FALSE;
+#elif defined(__WIN32__) && !defined(__WXMICROWIN__)
DWORD nSize = maxSize;
if ( !::GetComputerName(buf, &nSize) )
{
// shouldn't use winsock.dll (a.k.a. ws2_32.dll) at all so only use this
// code if we link with it anyhow
#if wxUSE_SOCKETS
-
WSADATA wsa;
if ( WSAStartup(MAKEWORD(1, 1), &wsa) == 0 )
{
// Get user ID e.g. jacs
bool wxGetUserId(wxChar *buf, int maxSize)
{
-#if defined(__WIN32__) && !defined(__win32s__) && !defined(__WXMICROWIN__)
+#if defined(__WXWINCE__)
+ return FALSE;
+#elif defined(__WIN32__) && !defined(__win32s__) && !defined(__WXMICROWIN__)
DWORD nSize = maxSize;
if ( ::GetUserName(buf, &nSize) == 0 )
{
// Get user name e.g. Julian Smart
bool wxGetUserName(wxChar *buf, int maxSize)
{
-#ifdef USE_NET_API
+#if defined(__WXWINCE__)
+ return FALSE;
+#elif defined(USE_NET_API)
CHAR szUserName[256];
if ( !wxGetUserId(szUserName, WXSIZEOF(szUserName)) )
return FALSE;
{
wxString& strDir = *pstr;
- #if defined(__UNIX__)
+#if defined(__UNIX__)
const wxChar *szHome = wxGetenv("HOME");
if ( szHome == NULL ) {
// we're homeless...
cygwin_conv_to_full_win32_path(strDir, windowsPath);
strDir = windowsPath;
#endif
- #else // Windows
+#elif defined(__WXWINCE__)
+ // Nothing
+#else
#ifdef __WIN32__
strDir.clear();
wxString strPath;
::GetModuleFileName(::GetModuleHandle(NULL),
- strPath.GetWriteBuf(MAX_PATH), MAX_PATH);
- strPath.UngetWriteBuf();
+ wxStringBuffer(strPath, MAX_PATH), MAX_PATH);
// extract the dir name
wxSplitPath(strPath, &strDir, NULL, NULL);
- #endif // UNIX/Win
+#endif // UNIX/Win
return strDir.c_str();
}
bool wxGetDiskSpace(const wxString& path, wxLongLong *pTotal, wxLongLong *pFree)
{
+#ifdef __WXWINCE__
+ return FALSE;
+#else
if ( path.empty() )
return FALSE;
}
return TRUE;
+#endif
+ // __WXWINCE__
}
// ----------------------------------------------------------------------------
bool wxGetEnv(const wxString& var, wxString *value)
{
-#ifdef __WIN16__
+#ifdef __WXWINCE__
+ return FALSE;
+#elif defined(__WIN16__)
const wxChar* ret = wxGetenv(var);
if ( !ret )
return FALSE;
if ( value )
{
- (void)::GetEnvironmentVariable(var, value->GetWriteBuf(dwRet), dwRet);
- value->UngetWriteBuf();
+ (void)::GetEnvironmentVariable(var, wxStringBuffer(*value, dwRet),
+ dwRet);
}
return TRUE;
{
// some compilers have putenv() or _putenv() or _wputenv() but it's better
// to always use Win32 function directly instead of dealing with them
-#if defined(__WIN32__)
+#if defined(__WIN32__) && !defined(__WXWINCE__)
if ( !::SetEnvironmentVariable(var, value) )
{
wxLogLastError(_T("SetEnvironmentVariable"));
// Execute a program in an Interactive Shell
bool wxShell(const wxString& command)
{
+#ifdef __WXWINCE__
+ return FALSE;
+#else
wxChar *shell = wxGetenv(wxT("COMSPEC"));
if ( !shell )
shell = (wxChar*) wxT("\\COMMAND.COM");
}
return wxExecute(cmd, wxEXEC_SYNC) == 0;
+#endif
}
// Shutdown or reboot the PC
bool wxShutdown(wxShutdownFlags wFlags)
{
-#ifdef __WIN32__
+#ifdef __WXWINCE__
+ return FALSE;
+#elif defined(__WIN32__)
bool bOK = TRUE;
if ( wxGetOsVersion(NULL, NULL) == wxWINDOWS_NT ) // if is NT or 2K
case VER_PLATFORM_WIN32_NT:
s_ver = wxWINDOWS_NT;
break;
+#ifdef __WXWINCE__
+ case VER_PLATFORM_WIN32_CE:
+ s_ver = wxWINDOWS_CE;
+ break;
+#endif
}
}
}
#endif // wxUSE_FONTMAP/!wxUSE_FONTMAP
-// ----------------------------------------------------------------------------
-// wxApp::OnFatalException() support
-// ----------------------------------------------------------------------------
-
-bool wxHandleFatalExceptions(bool doit)
-{
-#if wxUSE_ON_FATAL_EXCEPTION
- // assume this can only be called from the main thread
- gs_handleExceptions = doit;
-
- return TRUE;
-#else
- wxFAIL_MSG(_T("set wxUSE_ON_FATAL_EXCEPTION to 1 to use this function"));
-
- (void)doit;
- return FALSE;
-#endif
-}
-
-#if wxUSE_ON_FATAL_EXCEPTION
-
-extern unsigned long wxGlobalSEHandler()
-{
- if ( gs_handleExceptions && wxTheApp )
- {
- // give the user a chance to do something special about this
- wxTheApp->OnFatalException();
-
- // this will execute our handler and terminate the process
- return EXCEPTION_EXECUTE_HANDLER;
- }
-
- return EXCEPTION_CONTINUE_SEARCH;
-}
-
-#endif // wxUSE_ON_FATAL_EXCEPTION
-