-#ifndef __WXMICROWIN__
-wxChar *wxLoadUserResource(const wxString& resourceName, const wxString& resourceType)
-{
- HRSRC hResource = ::FindResource(wxGetInstance(), resourceName, resourceType);
- if ( hResource == 0 )
- return NULL;
-
- HGLOBAL hData = ::LoadResource(wxGetInstance(), hResource);
- if ( hData == 0 )
- return NULL;
-
- wxChar *theText = (wxChar *)::LockResource(hData);
- if ( !theText )
- return NULL;
-
- // Not all compilers put a zero at the end of the resource (e.g. BC++ doesn't).
- // so we need to find the length of the resource.
- int len = ::SizeofResource(wxGetInstance(), hResource);
- wxChar *s = new wxChar[len+1];
- wxStrncpy(s,theText,len);
- s[len]=0;
-
- // wxChar *s = copystring(theText);
-
- // Obsolete in WIN32
-#ifndef __WIN32__
- UnlockResource(hData);
-#endif
-
- // No need??
- // GlobalFree(hData);
-
- return s;
-}
-#endif // __WXMICROWIN__
-
-// ----------------------------------------------------------------------------
-// get display info
-// ----------------------------------------------------------------------------
-
-// See also the wxGetMousePosition in window.cpp
-// Deprecated: use wxPoint wxGetMousePosition() instead
-void wxGetMousePosition( int* x, int* y )
-{
- POINT pt;
- GetCursorPos( & pt );
- if ( x ) *x = pt.x;
- if ( y ) *y = pt.y;
-};
-
-// Return TRUE if we have a colour display
-bool wxColourDisplay()
-{
-#ifdef __WXMICROWIN__
- // MICROWIN_TODO
- return TRUE;
-#else
- // 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);
-
- s_isColour = (noCols == -1) || (noCols > 2);
- }
-
- return s_isColour != 0;
-#endif
-}
-
-// Returns depth of screen
-int wxDisplayDepth()
-{
- ScreenHDC dc;
- return GetDeviceCaps(dc, PLANES) * GetDeviceCaps(dc, BITSPIXEL);
-}
-
-// Get size of display
-void wxDisplaySize(int *width, int *height)
-{
-#ifdef __WXMICROWIN__
- RECT rect;
- HWND hWnd = GetDesktopWindow();
- ::GetWindowRect(hWnd, & rect);
-
- if ( width )
- *width = rect.right - rect.left;
- if ( height )
- *height = rect.bottom - rect.top;
-#else // !__WXMICROWIN__
- ScreenHDC dc;
-
- if ( width )
- *width = ::GetDeviceCaps(dc, HORZRES);
- if ( height )
- *height = ::GetDeviceCaps(dc, VERTRES);
-#endif // __WXMICROWIN__/!__WXMICROWIN__
-}
-
-void wxDisplaySizeMM(int *width, int *height)
-{
-#ifdef __WXMICROWIN__
- // MICROWIN_TODO
- if ( width )
- *width = 0;
- if ( height )
- *height = 0;
-#else
- ScreenHDC dc;
-
- if ( width )
- *width = ::GetDeviceCaps(dc, HORZSIZE);
- if ( height )
- *height = ::GetDeviceCaps(dc, VERTSIZE);
-#endif
-}
-
-void wxClientDisplayRect(int *x, int *y, int *width, int *height)
-{
-#if defined(__WIN16__) || defined(__WXMICROWIN__)
- *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
-// ---------------------------------------------------------------------------
-
-wxString WXDLLEXPORT wxGetWindowText(WXHWND hWnd)
-{
- wxString str;
-
- if ( hWnd )
- {
- int len = GetWindowTextLength((HWND)hWnd) + 1;
- ::GetWindowText((HWND)hWnd, str.GetWriteBuf(len), len);
- str.UngetWriteBuf();
- }
-
- return str;
-}
-
-wxString WXDLLEXPORT wxGetWindowClass(WXHWND hWnd)
-{
- wxString str;
-
- // MICROWIN_TODO
-#ifndef __WXMICROWIN__
- if ( hWnd )
- {
- int len = 256; // some starting value
-
- for ( ;; )
- {
- int count = ::GetClassName((HWND)hWnd, str.GetWriteBuf(len), len);
-
- str.UngetWriteBuf();
- if ( count == len )
- {
- // the class name might have been truncated, retry with larger
- // buffer
- len *= 2;
- }
- else
- {
- break;
- }
- }
- }