#include "wx/log.h"
#endif //WX_PRECOMP
+// 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
+// one in turn includes <winsock.h> unless we define WIN32_LEAN_AND_MEAN.
+//
+#if defined(__WIN32__) && !defined(__TWIN32__) && ! (defined(__GNUWIN32__) && !defined(__MINGW32__))
+extern "C" {
+ #include <winsock.h> // we use socket functions in wxGetFullHostName()
+}
+#endif
+
#include "wx/msw/private.h" // includes <windows.h>
#include "wx/timer.h"
#include <dir.h>
#endif
-#if defined(__WIN32__) && !defined(__TWIN32__)
- #include <winsock.h> // we use socket functions in wxGetFullHostName()
-#endif
-
// VZ: there is some code using NetXXX() functions to get the full user name:
// I don't think it's a good idea because they don't work under Win95 and
// seem to return the same as wxGetUserId() under NT. If you really want
#endif
# if defined(__WXDEBUG__) && wxUSE_GLOBAL_MEMORY_OPERATORS && wxUSE_DEBUG_NEW_ALWAYS
-# define new new(__FILE__,__LINE__)
+# define new new(__TFILE__,__LINE__)
# endif
#endif
DWORD nSize = maxSize;
if ( !::GetComputerName(buf, &nSize) )
{
- wxLogLastError("GetComputerName");
+ wxLogLastError(wxT("GetComputerName"));
return FALSE;
}
// get full hostname (with domain name if possible)
bool wxGetFullHostName(wxChar *buf, int maxSize)
{
-#if defined(__WIN32__) && !defined(__TWIN32__)
+#if defined(__WIN32__) && !defined(__TWIN32__) && ! (defined(__GNUWIN32__) && !defined(__MINGW32__))
// TODO should use GetComputerNameEx() when available
WSADATA wsa;
if ( WSAStartup(MAKEWORD(1, 1), &wsa) == 0 )
bool wxDirExists(const wxString& dir)
{
#if defined(__WIN32__)
- WIN32_FIND_DATA fileInfo;
+ DWORD attribs = GetFileAttributes(dir);
+ return ((attribs != -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("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?
*majorVsn = info.dwMajorVersion;
if (minorVsn)
*minorVsn = info.dwMinorVersion;
-
+
switch ( info.dwPlatformId )
{
case VER_PLATFORM_WIN32s:
return TRUE;
}
-#endif // wxUSE_GUI
-
// MSW only: get user-defined resource from the .res file.
// Returns NULL or newly-allocated memory, so use delete[] to clean up.
// get display info
// ----------------------------------------------------------------------------
+// See also the wxGetMousePosition in window.cpp
+// Deprecated: use wxPoint wxGetMousePosition() instead
void wxGetMousePosition( int* x, int* y )
{
POINT pt;
if ( height ) *height = GetDeviceCaps(dc, VERTRES);
}
+void wxDisplaySizeMM(int *width, int *height)
+{
+ ScreenHDC dc;
+
+ if ( width ) *width = GetDeviceCaps(dc, HORZSIZE);
+ if ( height ) *height = GetDeviceCaps(dc, VERTSIZE);
+}
+
+
// ---------------------------------------------------------------------------
// window information functions
// ---------------------------------------------------------------------------
#endif // Win16/32
}
+#endif // wxUSE_GUI
+
#if 0
//------------------------------------------------------------------------
// wild character routines
return ((*str == '\0') && (*pattern == '\0'));
};
-#endif
+#endif // 0
#if 0