]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/window.cpp
Fix some compilation and linking errors in samples.
[wxWidgets.git] / src / msw / window.cpp
index abdcc7dac160cf78ba010f5a96d22b91d637bbcf..51243e639252b8a7d971b1b29c40bd30c974b57f 100644 (file)
@@ -29,8 +29,7 @@
 #endif
 
 #ifndef WX_PRECOMP
-    #include <windows.h>
-    #include "wx/msw/winundef.h"
+    #include "wx/msw/wrapwin.h"
     #include "wx/window.h"
     #include "wx/accel.h"
     #include "wx/setup.h"
@@ -749,6 +748,7 @@ inline int GetScrollPosition(HWND hWnd, int wOrient)
     return ::GetScrollPosWX(hWnd, wOrient);
 #else
     SCROLLINFO scrollInfo;
+    scrollInfo.cbSize = sizeof(SCROLLINFO);
     scrollInfo.fMask = SIF_POS;
     if ( !::GetScrollInfo(hWnd,
                                   wOrient,
@@ -931,7 +931,7 @@ void wxWindowMSW::SubclassWin(WXHWND hWnd)
 
     // we don't need to subclass the window of our own class (in the Windows
     // sense of the word)
-    if ( !wxCheckWindowWndProc(hWnd, (WXFARPROC)wxWndProc) )
+       if ( !wxCheckWindowWndProc(hWnd, (WXFARPROC)wxWndProc) )
     {
         ::SetWindowLong(hwnd, GWL_WNDPROC, (LONG) wxWndProc);
     }
@@ -977,6 +977,28 @@ bool wxCheckWindowWndProc(WXHWND hWnd, WXFARPROC wndProc)
     // unicows.dll, we can override unicows hooks by setting
     // Unicows_{Set,Get}WindowLong and Unicows_RegisterClass to our own
     // versions that keep track of fake<->real wnd proc mapping.
+
+       // On WinCE (at least), the wndproc comparison doesn't work,
+       // so have to use something like this.
+#ifdef __WXWINCE__
+       extern const wxChar *wxCanvasClassName;
+       extern const wxChar *wxCanvasClassNameNR;
+       extern const wxChar *wxMDIFrameClassName;
+       extern const wxChar *wxMDIFrameClassNameNoRedraw;
+       extern const wxChar *wxMDIChildFrameClassName;
+       extern const wxChar *wxMDIChildFrameClassNameNoRedraw;
+       wxString str(wxGetWindowClass(hWnd));
+       if (str == wxCanvasClassName ||
+               str == wxCanvasClassNameNR ||
+               str == wxMDIFrameClassName || 
+               str == wxMDIFrameClassNameNoRedraw || 
+               str == wxMDIChildFrameClassName || 
+               str == wxMDIChildFrameClassNameNoRedraw || 
+               str == _T("wxTLWHiddenParent"))
+               return TRUE; // Effectively means don't subclass
+       else
+               return FALSE;
+#else
     WNDCLASS cls;
     if ( !::GetClassInfo(wxGetInstance(), wxGetWindowClass(hWnd), &cls) )
     {
@@ -986,6 +1008,7 @@ bool wxCheckWindowWndProc(WXHWND hWnd, WXFARPROC wndProc)
     }
 
     return wndProc == (WXFARPROC)cls.lpfnWndProc;
+#endif
 }
 
 // ----------------------------------------------------------------------------
@@ -2955,18 +2978,37 @@ bool wxWindowMSW::MSWCreate(const wxChar *wclass,
     // do create the window
     wxWindowCreationHook hook(this);
 
-    m_hWnd = (WXHWND)::CreateWindowEx
-                       (
-                            extendedStyle,
-                            className,
-                            title ? title : wxEmptyString,
-                            style,
-                            x, y, w, h,
-                            (HWND)MSWGetParent(),
-                            (HMENU)controlId,
-                            wxGetInstance(),
-                            NULL                        // no extra data
-                       );
+#ifdef __WXWINCE__
+    if (extendedStyle == 0)
+    {
+        m_hWnd = (WXHWND)::CreateWindow
+            (
+            className,
+            title ? title : wxEmptyString,
+            style,
+            x, y, w, h,
+            (HWND)MSWGetParent(),
+            (HMENU)controlId,
+            wxGetInstance(),
+            NULL                        // no extra data
+            );
+    }
+    else
+#endif
+    {
+        m_hWnd = (WXHWND)::CreateWindowEx
+            (
+            extendedStyle,
+            className,
+            title ? title : wxEmptyString,
+            style,
+            x, y, w, h,
+            (HWND)MSWGetParent(),
+            (HMENU)controlId,
+            wxGetInstance(),
+            NULL                        // no extra data
+            );
+    }
 
     if ( !m_hWnd )
     {