// In some mingws there is a missing extern "C" int the winsock header,
// so we put it here just to be safe. Note that this must appear _before_
-// #include "wx/msw/private.h" which itself includes <windows.h>, as this
+// #include "wx/msw/private.h" which itself includes <windows.h>, as this
// one in turn includes <winsock.h> unless we define WIN32_LEAN_AND_MEAN.
//
#if defined(__WIN32__) && !defined(__TWIN32__) && ! (defined(__GNUWIN32__) && !defined(__MINGW32__))
return strDir.c_str();
}
-wxChar *wxGetUserHome(const wxString& user)
+wxChar *wxGetUserHome(const wxString& WXUNUSED(user))
{
// VZ: the old code here never worked for user != "" anyhow! Moreover, it
// returned sometimes a malloc()'d pointer, sometimes a pointer to a
bool wxDirExists(const wxString& dir)
{
#if defined(__WIN32__)
- WIN32_FIND_DATA fileInfo;
+ DWORD attribs = GetFileAttributes(dir);
+ return ((attribs != (DWORD)-1) && (attribs & FILE_ATTRIBUTE_DIRECTORY));
#else // Win16
#ifdef __BORLANDC__
struct ffblk fileInfo;
#else
struct find_t fileInfo;
#endif
-#endif // Win32/16
-
-#if defined(__WIN32__)
- HANDLE h = ::FindFirstFile(dir, &fileInfo);
-
- if ( h == INVALID_HANDLE_VALUE )
- {
- wxLogLastError(wxT("FindFirstFile"));
-
- return FALSE;
- }
-
- ::FindClose(h);
-
- return (fileInfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
-#else // Win16
// In Borland findfirst has a different argument
// ordering from _dos_findfirst. But _dos_findfirst
// _should_ be ok in both MS and Borland... why not?
bool wxGetEnv(const wxString& var, wxString *value)
{
+#ifdef __WIN16__
+ const wxChar* ret = wxGetenv(var);
+ if (ret)
+ {
+ *value = ret;
+ return TRUE;
+ }
+ else
+ return FALSE;
+#else
// first get the size of the buffer
DWORD dwRet = ::GetEnvironmentVariable(var, NULL, 0);
if ( !dwRet )
}
return TRUE;
+#endif
}
bool wxSetEnv(const wxString& var, const wxChar *value)
// process management
// ----------------------------------------------------------------------------
-int wxKill(long pid, int sig)
+int wxKill(long WXUNUSED(pid), int WXUNUSED(sig))
{
// TODO use SendMessage(WM_QUIT) and TerminateProcess() if needed
case VER_PLATFORM_WIN32_WINDOWS:
str.Printf(_("Windows 9%c"),
- info.dwMinorVersion == 0 ? _T('5') : _T('9'));
+ info.dwMinorVersion == 0 ? _T('5') : _T('8'));
if ( !wxIsEmpty(info.szCSDVersion) )
{
str << _T(" (") << info.szCSDVersion << _T(')');
*majorVsn = info.dwMajorVersion;
if (minorVsn)
*minorVsn = info.dwMinorVersion;
-
+
switch ( info.dwPlatformId )
{
case VER_PLATFORM_WIN32s:
// Return TRUE if we have a colour display
bool wxColourDisplay()
{
- ScreenHDC dc;
- int noCols = GetDeviceCaps(dc, NUMCOLORS);
+ // this function is called from wxDC ctor so it is called a *lot* of times
+ // hence we optimize it a bit but doign the check only once
+ //
+ // this should be MT safe as only the GUI thread (holding the GUI mutex)
+ // can call us
+ static int s_isColour = -1;
+
+ if ( s_isColour == -1 )
+ {
+ ScreenHDC dc;
+ int noCols = ::GetDeviceCaps(dc, NUMCOLORS);
- return (noCols == -1) || (noCols > 2);
+ s_isColour = (noCols == -1) || (noCols > 2);
+ }
+
+ return s_isColour != 0;
}
// Returns depth of screen
if ( height ) *height = GetDeviceCaps(dc, VERTSIZE);
}
+void wxClientDisplayRect(int *x, int *y, int *width, int *height)
+{
+#ifdef __WIN16__
+ *x = 0; *y = 0;
+ wxDisplaySize(width, height);
+#else
+ // Determine the desktop dimensions minus the taskbar and any other
+ // special decorations...
+ RECT r;
+
+ SystemParametersInfo(SPI_GETWORKAREA, 0, &r, 0);
+ if (x) *x = r.left;
+ if (y) *y = r.top;
+ if (width) *width = r.right - r.left;
+ if (height) *height = r.bottom - r.top;
+#endif
+}
+
// ---------------------------------------------------------------------------
// window information functions
WXWORD WXDLLEXPORT wxGetWindowId(WXHWND hWnd)
{
#ifndef __WIN32__
- return GetWindowWord((HWND)hWnd, GWW_ID);
+ return (WXWORD)GetWindowWord((HWND)hWnd, GWW_ID);
#else // Win32
- return GetWindowLong((HWND)hWnd, GWL_ID);
+ return (WXWORD)GetWindowLong((HWND)hWnd, GWL_ID);
#endif // Win16/32
}