]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/utils.cpp
Fixed bug that was giving the wrong size of wxCustomDataObjects to the receiver.
[wxWidgets.git] / src / msw / utils.cpp
index 14346f1413a844fae01abfe845b3cf9fd6b70b58..2a9d0a99a4ed37c0c065ce1a9fa9aaa7eda030ea 100644 (file)
@@ -472,6 +472,47 @@ bool wxDirExists(const wxString& dir)
 #endif // Win32/16
 }
 
+// ----------------------------------------------------------------------------
+// env vars
+// ----------------------------------------------------------------------------
+
+bool wxGetEnv(const wxString& var, wxString *value)
+{
+    // 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;
+    }
+
+    if ( value )
+    {
+        (void)::GetEnvironmentVariable(var, value->GetWriteBuf(dwRet), dwRet);
+        value->UngetWriteBuf();
+    }
+
+    return TRUE;
+}
+
+bool wxSetEnv(const wxString& var, const wxChar *value)
+{
+    // 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 ( !::SetEnvironmentVariable(var, value) )
+    {
+        wxLogLastError(_T("SetEnvironmentVariable"));
+
+        return FALSE;
+    }
+
+    return TRUE;
+#else // no way to set env vars
+    return FALSE;
+#endif
+}
+
 // ----------------------------------------------------------------------------
 // process management
 // ----------------------------------------------------------------------------
@@ -547,7 +588,7 @@ wxString wxGetOsDescription()
 
             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(')');
@@ -951,6 +992,8 @@ wxChar *wxLoadUserResource(const wxString& resourceName, const wxString& resourc
 // get display info
 // ----------------------------------------------------------------------------
 
+// See also the wxGetMousePosition in window.cpp
+// Deprecated: use wxPoint wxGetMousePosition() instead
 void wxGetMousePosition( int* x, int* y )
 {
     POINT pt;
@@ -984,6 +1027,15 @@ void wxDisplaySize(int *width, int *height)
     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
 // ---------------------------------------------------------------------------