checkWidth = -1 ;
     checkHeight = -1 ;
-    long msStyle = CHECK_FLAGS;
+//    long msStyle = CHECK_FLAGS;
 
     HWND wx_button = 0; // TODO: Create the bitmap checkbox
 
 
 
 #include <string.h>
 
-#define INCL_DOS
-#define INCL_PM
-#include <os2.h>
-
 #include "wx/os2/private.h"
 
 // wxDataObject is tied to OLE/drag and drop implementation,
 
 #endif
 
 #define INCL_PM
+#define INCL_DOS
 #include <os2.h>
 #include "wx/window.h"
 #include "wx/app.h"
 
 
 #include "wx/string.h"
 #define INCL_PM
-#include "os2.h"
+#define INCL_DOS
 #include "wx/os2/private.h"
 
 #define NO_JOYGETPOSEX
 
 #   include <fstream>
 #endif
 
-#define INCL_DOS
-#define INCL_PM
-#define INCL_GPI
-#include <os2.h>
 #include "wx/palette.h"
 #include "wx/bitmap.h"
 #include "wx/utils.h"
+
+#define INCL_PM
+#include <os2.h>
+
 #include "wx/os2/pngread.h"
 
 extern "C" {
 
     }
 }
 
+// ----------------------------------------------------------------------------
+// wxCriticalSection implementation
+// ----------------------------------------------------------------------------
+
+wxCriticalSection::wxCriticalSection()
+{
+}
+
+wxCriticalSection::~wxCriticalSection()
+{
+}
+
+void wxCriticalSection::Enter()
+{
+    ::DosEnterCritSec();
+}
+
+void wxCriticalSection::Leave()
+{
+    ::DosExitCritSec();
+}
+
 // ----------------------------------------------------------------------------
 // wxThread implementation
 // ----------------------------------------------------------------------------
 
 #include <sys/types.h>
 
 #include <sys/timeb.h>
-
 // ----------------------------------------------------------------------------
 // private functions
 // ----------------------------------------------------------------------------
 
 {
     HPS                             hpsScreen;
     HDC                             hdcScreen;
+    LONG                            lWidth;
+    LONG                            lHeight;
 
     hpsScreen = ::WinGetScreenPS(HWND_DESKTOP);
     hdcScreen = ::GpiQueryDevice(hpsScreen);
-    ::DevQueryCaps(hdcScreen, CAPS_WIDTH, 1L, (PLONG)pWidth);
-    ::DevQueryCaps(hdcScreen, CAPS_HEIGHT, 1L, (PLONG)pHeight);
+    ::DevQueryCaps(hdcScreen, CAPS_WIDTH, 1L, &lWidth);
+    ::DevQueryCaps(hdcScreen, CAPS_HEIGHT, 1L, &lHeight);
     DevCloseDC(hdcScreen);
+    *pWidth = (int)lWidth;
+    *pHeight = (int)lHeight;
 }
 
 bool wxDirExists(
 
 
 #include "wx/os2/private.h"
 
-#define INCL_DOSPROCESS
-#define INCL_DOSERRORS
-#define INCL_DOS
-#include <os2.h>
 #define PURE_32
 #include <upm.h>
 #include <netcons.h>
 
 #include "wx/os2/wave.h"
 #include "wx/os2/private.h"
 
-#define INCL_DOS
-#define INCL_PM
-#include <os2.h>
 #ifdef RECT
     #undef RECT
 #endif