changeset 113:f353be82b6be

More "static if" changes
author John Reimer <terminal.node@gmail.com
date Sun, 10 Feb 2008 18:42:25 -0800
parents 9ad59dbf99d2
children aa406905e538 640928daee8c
files dwt/graphics/Cursor.d dwt/graphics/Device.d dwt/graphics/GC.d dwt/graphics/Image.d dwt/graphics/Region.d dwt/internal/ImageList.d dwt/ole/win32/OleFrame.d dwt/widgets/Canvas.d dwt/widgets/Combo.d dwt/widgets/Composite.d dwt/widgets/CoolBar.d dwt/widgets/Decorations.d dwt/widgets/Display.d dwt/widgets/FileDialog.d dwt/widgets/FontDialog.d dwt/widgets/Group.d dwt/widgets/Label.d dwt/widgets/Menu.d dwt/widgets/MenuItem.d dwt/widgets/MessageBox.d dwt/widgets/Sash.d dwt/widgets/ScrollBar.d dwt/widgets/Shell.d dwt/widgets/Slider.d dwt/widgets/Spinner.d dwt/widgets/Table.d dwt/widgets/Text.d dwt/widgets/ToolBar.d dwt/widgets/ToolTip.d dwt/widgets/Tree.d dwt/widgets/TreeItem.d
diffstat 31 files changed, 236 insertions(+), 228 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/graphics/Cursor.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/graphics/Cursor.d	Sun Feb 10 18:42:25 2008 -0800
@@ -231,7 +231,7 @@
         int height = OS.GetSystemMetrics(OS.SM_CYCURSOR);
         if (width is 32 && height is 32) {
             auto hInst = OS.GetModuleHandle(null);
-            if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
+            static if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
             handle = OS.CreateCursor(hInst, 5, 0, 32, 32, HAND_SOURCE.ptr, HAND_MASK.ptr);
 
         }
@@ -301,7 +301,7 @@
 
     /* Create the cursor */
     auto hInst = OS.GetModuleHandle(null);
-    if (OS.IsWinCE) DWT.error (DWT.ERROR_NOT_IMPLEMENTED);
+    static if (OS.IsWinCE) DWT.error (DWT.ERROR_NOT_IMPLEMENTED);
     handle = OS.CreateCursor(hInst, hotspotX, hotspotY, source.width, source.height, sourceData.ptr, maskData.ptr);
     if (handle is null) DWT.error(DWT.ERROR_NO_HANDLES);
     if (device.tracking) device.new_Object(this);
@@ -396,7 +396,7 @@
         * destroy them all. If this causes problems in the future,
         * put the flag back in.
         */
-        if (!OS.IsWinCE) OS.DestroyCursor(handle);
+        static if (!OS.IsWinCE) OS.DestroyCursor(handle);
     }
     handle = null;
     if (device.tracking) device.dispose_Object(this);
--- a/dwt/graphics/Device.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/graphics/Device.d	Sun Feb 10 18:42:25 2008 -0800
@@ -195,7 +195,7 @@
 
 void checkGDIP() {
     if (gdipToken) return;
-    if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
+    static if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
     int oldErrorMode = OS.SetErrorMode (OS.SEM_FAILCRITICALERRORS);
     try {
         ULONG_PTR token;
@@ -673,11 +673,11 @@
  */
 protected void init () {
     if (debug_) {
-        if (!OS.IsWinCE) OS.GdiSetBatchLimit(1);
+        static if (!OS.IsWinCE) OS.GdiSetBatchLimit(1);
     }
 
     /* Initialize scripts list */
-    if (!OS.IsWinCE) {
+    static if (!OS.IsWinCE) {
         SCRIPT_PROPERTIES** ppSp;
         int piNumScripts;
         OS.ScriptGetProperties (&ppSp, &piNumScripts);
@@ -702,7 +702,7 @@
     int numReserved = OS.GetDeviceCaps (hDC, OS.NUMRESERVED);
     int numEntries = OS.GetDeviceCaps (hDC, OS.SIZEPALETTE);
 
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         /*
         * Feature on WinCE.  For some reason, certain 8 bit WinCE
         * devices return 0 for the number of reserved entries in
--- a/dwt/graphics/GC.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/graphics/GC.d	Sun Feb 10 18:42:25 2008 -0800
@@ -553,25 +553,27 @@
         * vertical and horizontal scrolling.  The fix is to do a
         * BitBlt and invalidate the appropriate source area.
         */
-        if (res is 0 && OS.IsWinCE) {
-            OS.BitBlt(handle, destX, destY, width, height, handle, srcX, srcY, OS.SRCCOPY);
-            if (paint) {
-                int deltaX = destX - srcX, deltaY = destY - srcY;
-                bool disjoint = (destX + width < srcX) || (srcX + width < destX) || (destY + height < srcY) || (srcY + height < destY);
-                if (disjoint) {
-                    OS.InvalidateRect(hwnd, &lprcScroll, true);
-                } else {
-                    if (deltaX !is 0) {
-                        int newX = destX - deltaX;
-                        if (deltaX < 0) newX = destX + width;
-                        OS.SetRect(&lprcScroll, newX, srcY, newX + Math.abs(deltaX), srcY + height);
+        static if (OS.IsWinCE) {
+            if (res is 0) {
+                OS.BitBlt(handle, destX, destY, width, height, handle, srcX, srcY, OS.SRCCOPY);
+                if (paint) {
+                    int deltaX = destX - srcX, deltaY = destY - srcY;
+                    bool disjoint = (destX + width < srcX) || (srcX + width < destX) || (destY + height < srcY) || (srcY + height < destY);
+                    if (disjoint) {
                         OS.InvalidateRect(hwnd, &lprcScroll, true);
-                    }
-                    if (deltaY !is 0) {
-                        int newY = destY - deltaY;
-                        if (deltaY < 0) newY = destY + height;
-                        OS.SetRect(&lprcScroll, srcX, newY, srcX + width, newY + Math.abs(deltaY));
-                        OS.InvalidateRect(hwnd, &lprcScroll, true);
+                    } else {
+                        if (deltaX !is 0) {
+                            int newX = destX - deltaX;
+                            if (deltaX < 0) newX = destX + width;
+                            OS.SetRect(&lprcScroll, newX, srcY, newX + Math.abs(deltaX), srcY + height);
+                            OS.InvalidateRect(hwnd, &lprcScroll, true);
+                        }
+                        if (deltaY !is 0) {
+                            int newY = destY - deltaY;
+                            if (deltaY < 0) newY = destY + height;
+                            OS.SetRect(&lprcScroll, srcX, newY, srcX + width, newY + Math.abs(deltaY));
+                            OS.InvalidateRect(hwnd, &lprcScroll, true);
+                        }
                     }
                 }
             }
@@ -768,7 +770,7 @@
     * WinCE SDK.  The fix is to emulate arc drawing by using
     * Polyline.
     */
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         /* compute arc with a simple linear interpolation */
         if (arcAngle < 0) {
             startAngle += arcAngle;
@@ -1057,7 +1059,7 @@
 
     /* Get the icon info */
     ICONINFO srcIconInfo;
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         Image.GetIconInfo(srcImage, &srcIconInfo);
     } else {
         OS.GetIconInfo(srcImage.handle, &srcIconInfo);
@@ -1109,7 +1111,7 @@
             auto oldDestBitmap = OS.SelectObject(dstHdc, newIconInfo.hbmColor);
             bool stretch = !simple && (srcWidth !is destWidth || srcHeight !is destHeight);
             if (stretch) {
-                if (!OS.IsWinCE) OS.SetStretchBltMode(dstHdc, OS.COLORONCOLOR);
+                static if (!OS.IsWinCE) OS.SetStretchBltMode(dstHdc, OS.COLORONCOLOR);
                 OS.StretchBlt(dstHdc, 0, 0, destWidth, destHeight, srcHdc, srcX, srcColorY, srcWidth, srcHeight, OS.SRCCOPY);
             } else {
                 OS.BitBlt(dstHdc, 0, 0, destWidth, destHeight, srcHdc, srcX, srcColorY, OS.SRCCOPY);
@@ -1336,7 +1338,7 @@
         if (tempDib is null) DWT.error(DWT.ERROR_NO_HANDLES);
         auto oldTempBitmap = OS.SelectObject(tempHdc, tempDib);
         if (!simple && (srcWidth !is destWidth || srcHeight !is destHeight)) {
-            if (!OS.IsWinCE) OS.SetStretchBltMode(memHdc, OS.COLORONCOLOR);
+            static if (!OS.IsWinCE) OS.SetStretchBltMode(memHdc, OS.COLORONCOLOR);
             OS.StretchBlt(tempHdc, 0, 0, destWidth, destHeight, memHdc, 0, 0, srcWidth, srcHeight, OS.SRCCOPY);
         } else {
             OS.BitBlt(tempHdc, 0, 0, destWidth, destHeight, memHdc, 0, 0, OS.SRCCOPY);
@@ -1347,7 +1349,7 @@
         OS.DeleteDC(tempHdc);
     } else {
         if (!simple && (srcWidth !is destWidth || srcHeight !is destHeight)) {
-            if (!OS.IsWinCE) OS.SetStretchBltMode(memHdc, OS.COLORONCOLOR);
+            static if (!OS.IsWinCE) OS.SetStretchBltMode(memHdc, OS.COLORONCOLOR);
             OS.StretchBlt(memHdc, 0, 0, destWidth, destHeight, memHdc, 0, 0, srcWidth, srcHeight, OS.SRCCOPY);
         } else {
             OS.BitBlt(memHdc, 0, 0, destWidth, destHeight, memHdc, 0, 0, OS.SRCCOPY);
@@ -1412,7 +1414,7 @@
     if (result is 1) OS.CombineRgn(rgn, rgn, clip, OS.RGN_AND);
     OS.SelectClipRgn(handle, rgn);
     int rop2 = 0;
-    if (!OS.IsWinCE) {
+    static if (!OS.IsWinCE) {
         rop2 = OS.GetROP2(handle);
     } else {
         rop2 = OS.SetROP2 (handle, OS.R2_COPYPEN);
@@ -1421,9 +1423,9 @@
     int dwRop = rop2 is OS.R2_XORPEN ? OS.SRCINVERT : OS.SRCCOPY;
     if (!simple && (srcWidth !is destWidth || srcHeight !is destHeight)) {
         int mode = 0;
-        if (!OS.IsWinCE) mode = OS.SetStretchBltMode(handle, OS.COLORONCOLOR);
+        static if (!OS.IsWinCE) mode = OS.SetStretchBltMode(handle, OS.COLORONCOLOR);
         OS.StretchBlt(handle, destX, destY, destWidth, destHeight, srcHdc, srcX, srcY, srcWidth, srcHeight, dwRop);
-        if (!OS.IsWinCE) OS.SetStretchBltMode(handle, mode);
+        static if (!OS.IsWinCE) OS.SetStretchBltMode(handle, mode);
     } else {
         OS.BitBlt(handle, destX, destY, destWidth, destHeight, srcHdc, srcX, srcY, dwRop);
     }
@@ -1458,13 +1460,13 @@
     }
     if (!simple && (srcWidth !is destWidth || srcHeight !is destHeight)) {
         int mode = 0;
-        if (!OS.IsWinCE) mode = OS.SetStretchBltMode(handle, OS.COLORONCOLOR);
+        static if (!OS.IsWinCE) mode = OS.SetStretchBltMode(handle, OS.COLORONCOLOR);
         OS.StretchBlt(destHdc, x, y, destWidth, destHeight, srcHdc, srcX, srcColorY, srcWidth, srcHeight, OS.SRCINVERT);
         OS.SelectObject(srcHdc, srcMask);
         OS.StretchBlt(destHdc, x, y, destWidth, destHeight, srcHdc, srcX, srcY, srcWidth, srcHeight, OS.SRCAND);
         OS.SelectObject(srcHdc, srcColor);
         OS.StretchBlt(destHdc, x, y, destWidth, destHeight, srcHdc, srcX, srcColorY, srcWidth, srcHeight, OS.SRCINVERT);
-        if (!OS.IsWinCE) OS.SetStretchBltMode(handle, mode);
+        static if (!OS.IsWinCE) OS.SetStretchBltMode(handle, mode);
     } else {
         OS.BitBlt(destHdc, x, y, destWidth, destHeight, srcHdc, srcX, srcColorY, OS.SRCINVERT);
         OS.SetTextColor(destHdc, 0);
@@ -1498,7 +1500,7 @@
     if (bm.bmBitsPixel <= 8) {
         if (isDib) {
             /* Palette-based DIBSECTION */
-            if (OS.IsWinCE) {
+            static if (OS.IsWinCE) {
                 byte* pBits = cast(byte*)bm.bmBits;
                 //OS.MoveMemory(pBits, bm.bmBits, 1);
                 byte oldValue = pBits[0];
@@ -1549,7 +1551,7 @@
             bmiHeader.biBitCount = bm.bmBitsPixel;
             byte[] bmi = new byte[BITMAPINFOHEADER.sizeof + numColors * 4];
             bmi[] = (cast(byte*)&bmiHeader)[ 0 .. BITMAPINFOHEADER.sizeof ];
-            if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
+            static if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
             OS.GetDIBits(srcHdc, srcImage.handle, 0, 0, null, cast(BITMAPINFO*)bmi.ptr, OS.DIB_RGB_COLORS);
             int offset = BITMAPINFOHEADER.sizeof + 4 * srcImage.transparentPixel;
             transRed = bmi[offset + 2] & 0xFF;
@@ -1610,7 +1612,7 @@
             auto oldTempBitmap = OS.SelectObject(tempHdc, tempBitmap);
             OS.BitBlt(tempHdc, 0, 0, destWidth, destHeight, handle, destX, destY, OS.SRCCOPY);
             if (!simple && (srcWidth !is destWidth || srcHeight !is destHeight)) {
-                if (!OS.IsWinCE) OS.SetStretchBltMode(tempHdc, OS.COLORONCOLOR);
+                static if (!OS.IsWinCE) OS.SetStretchBltMode(tempHdc, OS.COLORONCOLOR);
                 OS.StretchBlt(tempHdc, 0, 0, destWidth, destHeight, srcHdc, srcX, srcY, srcWidth, srcHeight, OS.SRCINVERT);
                 OS.StretchBlt(tempHdc, 0, 0, destWidth, destHeight, maskHdc, srcX, srcY, srcWidth, srcHeight, OS.SRCAND);
                 OS.StretchBlt(tempHdc, 0, 0, destWidth, destHeight, srcHdc, srcX, srcY, srcWidth, srcHeight, OS.SRCINVERT);
@@ -1637,7 +1639,7 @@
     auto srcHdc = OS.CreateCompatibleDC(handle);
     auto oldSrcBitmap = OS.SelectObject(srcHdc, srcImage.handle);
     int rop2 = 0;
-    if (!OS.IsWinCE) {
+    static if (!OS.IsWinCE) {
         rop2 = OS.GetROP2(handle);
     } else {
         rop2 = OS.SetROP2 (handle, OS.R2_COPYPEN);
@@ -1646,9 +1648,9 @@
     int dwRop = rop2 is OS.R2_XORPEN ? OS.SRCINVERT : OS.SRCCOPY;
     if (!simple && (srcWidth !is destWidth || srcHeight !is destHeight)) {
         int mode = 0;
-        if (!OS.IsWinCE) mode = OS.SetStretchBltMode(handle, OS.COLORONCOLOR);
+        static if (!OS.IsWinCE) mode = OS.SetStretchBltMode(handle, OS.COLORONCOLOR);
         OS.StretchBlt(handle, destX, destY, destWidth, destHeight, srcHdc, srcX, srcY, srcWidth, srcHeight, dwRop);
-        if (!OS.IsWinCE) OS.SetStretchBltMode(handle, mode);
+        static if (!OS.IsWinCE) OS.SetStretchBltMode(handle, mode);
     } else {
         OS.BitBlt(handle, destX, destY, destWidth, destHeight, srcHdc, srcX, srcY, dwRop);
     }
@@ -1685,7 +1687,7 @@
             x2--;
         }
     }
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         int [] points = [x1, y1, x2, y2];
         OS.Polyline (handle, cast(POINT*)points.ptr, points.length / 2);
     } else {
@@ -1985,7 +1987,7 @@
     if ((data.style & DWT.MIRRORED) !is 0) {
         if (data.lineWidth !is 0 && data.lineWidth % 2 is 0) x--;
     }
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         /*
         * Bug in WinCE PPC.  On certain devices, RoundRect does not draw
         * all the pixels.  The workaround is to draw a round rectangle
@@ -2176,7 +2178,7 @@
         return;
     }
     int rop2 = 0;
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         rop2 = OS.SetROP2(handle, OS.R2_COPYPEN);
         OS.SetROP2(handle, rop2);
     } else {
@@ -2400,7 +2402,7 @@
         uFormat |= OS.DT_HIDEPREFIX;
     }
     int rop2 = 0;
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         rop2 = OS.SetROP2(handle, OS.R2_COPYPEN);
         OS.SetROP2(handle, rop2);
     } else {
@@ -2517,7 +2519,7 @@
     * Feature in WinCE.  The function Pie is not present in the
     * WinCE SDK.  The fix is to emulate it by using Polygon.
     */
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         /* compute arc with a simple linear interpolation */
         if (arcAngle < 0) {
             startAngle += arcAngle;
@@ -2651,7 +2653,7 @@
     * GradientFill for printer devices.
     */
     int rop2 = 0;
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         rop2 = OS.SetROP2(handle, OS.R2_COPYPEN);
         OS.SetROP2(handle, rop2);
     } else {
@@ -2821,7 +2823,7 @@
         return;
     }
     int rop2 = 0;
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         rop2 = OS.SetROP2(handle, OS.R2_COPYPEN);
         OS.SetROP2(handle, rop2);
     } else {
@@ -3267,7 +3269,7 @@
  */
 public int getFillRule() {
     if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED);
-    if (OS.IsWinCE) return DWT.FILL_EVEN_ODD;
+    static if (OS.IsWinCE) return DWT.FILL_EVEN_ODD;
     return OS.GetPolyFillMode(handle) is OS.WINDING ? DWT.FILL_WINDING : DWT.FILL_EVEN_ODD;
 }
 
@@ -3613,7 +3615,7 @@
 public bool getXORMode() {
     if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED);
     int rop2 = 0;
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         rop2 = OS.SetROP2 (handle, OS.R2_COPYPEN);
         OS.SetROP2 (handle, rop2);
     } else {
@@ -3691,7 +3693,7 @@
             width = rect.right - rect.left;
         }
         POINT pt;
-        if (!OS.IsWinCE) OS.GetWindowOrgEx (handle, &pt);
+        static if (!OS.IsWinCE) OS.GetWindowOrgEx (handle, &pt);
         return Gdip.Matrix_new(-1, 0, 0, 1, width + 2 * pt.x, 0);
     }
     return Gdip.Matrix_new(1, 0, 0, 1, 0, 0);
@@ -4148,7 +4150,7 @@
  */
 public void setFillRule(int rule) {
     if (handle is null) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED);
-    if (OS.IsWinCE) return;
+    static if (OS.IsWinCE) return;
     int mode = OS.ALTERNATE;
     switch (rule) {
         case DWT.FILL_WINDING: mode = OS.WINDING; break;
--- a/dwt/graphics/Image.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/graphics/Image.d	Sun Feb 10 18:42:25 2008 -0800
@@ -268,7 +268,7 @@
                     }
                     break;
                 case DWT.ICON:
-                    if (OS.IsWinCE) {
+                    static if (OS.IsWinCE) {
                         init(device, srcImage.data);
                     } else {
                         handle = OS.CopyImage(srcImage.handle, OS.IMAGE_ICON, rect.width, rect.height, 0);
@@ -983,7 +983,7 @@
             * detect this and create a PixelFormat32bppARGB image instead.
             */
             ICONINFO iconInfo;
-            if (OS.IsWinCE) {
+            static if (OS.IsWinCE) {
                 GetIconInfo(this, &iconInfo);
             } else {
                 OS.GetIconInfo(handle, &iconInfo);
@@ -1053,7 +1053,7 @@
     if (device.isDisposed()) return;
     if (memGC !is null) memGC.dispose();
     if (type is DWT.ICON) {
-        if (OS.IsWinCE) data = null;
+        static if (OS.IsWinCE) data = null;
         OS.DestroyIcon (handle);
     } else {
         OS.DeleteObject (handle);
@@ -1113,7 +1113,7 @@
     auto hOldObject = OS.SelectObject(hdcMem, handle);
     int red = 0, green = 0, blue = 0;
     if (bm.bmBitsPixel <= 8)  {
-        if (OS.IsWinCE) {
+        static if (OS.IsWinCE) {
             byte[1] pBits;
             OS.MoveMemory(pBits.ptr, bm.bmBits, 1);
             byte oldValue = pBits[0];
@@ -1185,7 +1185,7 @@
             OS.GetObject(handle, BITMAP.sizeof, &bm);
             return new Rectangle(0, 0, width = bm.bmWidth, height = bm.bmHeight);
         case DWT.ICON:
-            if (OS.IsWinCE) {
+            static if (OS.IsWinCE) {
                 return new Rectangle(0, 0, width = data.width, height = data.height);
             } else {
                 ICONINFO info;
@@ -1225,9 +1225,9 @@
     int depth, width, height;
     switch (type) {
         case DWT.ICON: {
-            if (OS.IsWinCE) return data;
+            static if (OS.IsWinCE) return data;
             ICONINFO info;
-            if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
+            static if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
             OS.GetIconInfo(handle, &info);
             /* Get the basic BITMAP information */
             auto hBitmap = info.hbmColor;
@@ -1268,7 +1268,7 @@
             /* Find the size of the image and allocate data */
             int imageSize;
             /* Call with null lpBits to get the image size */
-            if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
+            static if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
             OS.GetDIBits(hBitmapDC, hBitmap, 0, height, null, cast(BITMAPINFO*)bmi.ptr, OS.DIB_RGB_COLORS);
             OS.MoveMemory(&bmiHeader, bmi.ptr, BITMAPINFOHEADER.sizeof);
             imageSize = bmiHeader.biSizeImage;
@@ -1277,7 +1277,7 @@
             auto hHeap = OS.GetProcessHeap();
             auto lpvBits = cast(byte*) OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, imageSize);
             if (lpvBits is null) DWT.error(DWT.ERROR_NO_HANDLES);
-            if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
+            static if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
             OS.GetDIBits(hBitmapDC, hBitmap, 0, height, lpvBits, cast(BITMAPINFO*)bmi.ptr, OS.DIB_RGB_COLORS);
             OS.MoveMemory(data.ptr, lpvBits, imageSize);
             /* Calculate the palette */
@@ -1304,7 +1304,7 @@
             byte [] maskData = null;
             if (info.hbmColor is null) {
                 /* Do the bottom half of the mask */
-                if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
+                static if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
                 OS.GetDIBits(hBitmapDC, hBitmap, height, height, lpvBits, cast(BITMAPINFO*)bmi.ptr, OS.DIB_RGB_COLORS);
                 OS.MoveMemory(maskData.ptr, lpvBits, imageSize);
             } else {
@@ -1326,14 +1326,14 @@
                 bmi[offset + 7] = 0;
                 OS.SelectObject(hBitmapDC, info.hbmMask);
                 /* Call with null lpBits to get the image size */
-                if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
+                static if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
                 OS.GetDIBits(hBitmapDC, info.hbmMask, 0, height, null, cast(BITMAPINFO*)bmi.ptr, OS.DIB_RGB_COLORS);
                 OS.MoveMemory(&bmiHeader, bmi.ptr, BITMAPINFOHEADER.sizeof);
                 imageSize = bmiHeader.biSizeImage;
                 maskData = new byte[imageSize];
                 auto lpvMaskBits = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, imageSize);
                 if (lpvMaskBits is null) DWT.error(DWT.ERROR_NO_HANDLES);
-                if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
+                static if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
                 OS.GetDIBits(hBitmapDC, info.hbmMask, 0, height, lpvMaskBits, cast(BITMAPINFO*)bmi.ptr, OS.DIB_RGB_COLORS);
                 OS.MoveMemory(maskData.ptr, lpvMaskBits, imageSize);
                 OS.HeapFree(hHeap, 0, lpvMaskBits);
@@ -1388,7 +1388,7 @@
             * the bmBits field of DIBSECTION to retrieve the image data.
             */
             auto handle = this.handle;
-            if (OS.IsWinCE) {
+            static if (OS.IsWinCE) {
                 if (!isDib) {
                     bool mustRestore = false;
                     if (memGC !is null && !memGC.isDisposed()) {
@@ -1453,7 +1453,7 @@
                 imageSize = dib.biSizeImage;
             } else {
                 /* Call with null lpBits to get the image size */
-                if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
+                static if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
                 OS.GetDIBits(hBitmapDC, handle, 0, height, null, cast(BITMAPINFO*)bmi.ptr, OS.DIB_RGB_COLORS);
                 OS.MoveMemory(&bmiHeader, bmi.ptr, BITMAPINFOHEADER.sizeof);
                 imageSize = bmiHeader.biSizeImage;
@@ -1461,9 +1461,11 @@
             byte[] data = new byte[imageSize];
             /* Get the bitmap data */
             if (isDib) {
-                if (OS.IsWinCE && this.handle !is handle) {
-                    /* get image data from the temporary DIB */
-                    OS.MoveMemory(data.ptr, dib.bmBits, imageSize);
+                if (OS.IsWinCE) {
+                    if (this.handle !is handle) {
+                        /* get image data from the temporary DIB */
+                        OS.MoveMemory(data.ptr, dib.bmBits, imageSize);
+                    }
                 } else {
                     OS.MoveMemory(data.ptr, bm.bmBits, imageSize);
                 }
@@ -1471,7 +1473,7 @@
                 auto hHeap = OS.GetProcessHeap();
                 auto lpvBits = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, imageSize);
                 if (lpvBits is null) DWT.error(DWT.ERROR_NO_HANDLES);
-                if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
+                static if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
                 OS.GetDIBits(hBitmapDC, handle, 0, height, lpvBits, cast(BITMAPINFO*)bmi.ptr, OS.DIB_RGB_COLORS);
                 OS.MoveMemory(data.ptr, lpvBits, imageSize);
                 OS.HeapFree(hHeap, 0, lpvBits);
@@ -1481,7 +1483,7 @@
             if (depth <= 8) {
                 RGB[] rgbs = new RGB[numColors];
                 if (isDib) {
-                    if (OS.IsWinCE) {
+                    static if (OS.IsWinCE) {
                         /*
                         * Feature on WinCE.  GetDIBColorTable is not supported.
                         * The workaround is to set a pixel to the desired
@@ -1536,7 +1538,7 @@
                 OS.SelectPalette(hBitmapDC, oldPalette, false);
                 OS.RealizePalette(hBitmapDC);
             }
-            if (OS.IsWinCE) {
+            static if (OS.IsWinCE) {
                 if (handle !is this.handle) {
                     /* free temporary DIB */
                     OS.DeleteObject (handle);
@@ -1617,12 +1619,12 @@
     bmiHeader.biHeight = -height;
     bmiHeader.biPlanes = 1;
     bmiHeader.biBitCount = cast(short)depth;
-    if (OS.IsWinCE) bmiHeader.biCompression = OS.BI_BITFIELDS;
+    static if (OS.IsWinCE) bmiHeader.biCompression = OS.BI_BITFIELDS;
     else bmiHeader.biCompression = OS.BI_RGB;
     byte[] bmi = new byte[BITMAPINFOHEADER.sizeof + (OS.IsWinCE ? 12 : 0)];
     OS.MoveMemory(bmi.ptr, &bmiHeader, BITMAPINFOHEADER.sizeof);
     /* Set the rgb colors into the bitmap info */
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         int redMask = 0xFF00;
         int greenMask = 0xFF0000;
         int blueMask = 0xFF000000;
@@ -1872,7 +1874,7 @@
             OS.DeleteObject(hMask);
             image.handle = hIcon;
             image.type = DWT.ICON;
-            if (OS.IsWinCE) image.data = i;
+            static if (OS.IsWinCE) image.data = i;
         }
     } else {
         if (image is null) {
@@ -2085,7 +2087,7 @@
     /*
     * Note.  Not implemented on WinCE.
     */
-    if (OS.IsWinCE) return;
+    static if (OS.IsWinCE) return;
     if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED);
     if (color is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
     if (color.isDisposed()) DWT.error(DWT.ERROR_INVALID_ARGUMENT);
@@ -2101,13 +2103,13 @@
     OS.SelectObject(hdcMem, handle);
     int maxColors = 1 << bm.bmBitsPixel;
     byte[] colors = new byte[maxColors * 4];
-    if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
+    static if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
     int numColors = OS.GetDIBColorTable(hdcMem, 0, maxColors, cast(RGBQUAD*)colors.ptr);
     int offset = transparentPixel * 4;
     colors[offset] = cast(byte)color.getBlue();
     colors[offset + 1] = cast(byte)color.getGreen();
     colors[offset + 2] = cast(byte)color.getRed();
-    if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
+    static if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
     OS.SetDIBColorTable(hdcMem, 0, numColors, cast(RGBQUAD*)colors.ptr);
     OS.DeleteDC(hdcMem);
 
--- a/dwt/graphics/Region.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/graphics/Region.d	Sun Feb 10 18:42:25 2008 -0800
@@ -119,7 +119,7 @@
 public void add (int[] pointArray) {
     if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED);
     if (pointArray is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
-    if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
+    static if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
     auto polyRgn = OS.CreatePolygonRgn(cast(POINT*)pointArray.ptr, pointArray.length / 2, OS.ALTERNATE);
     OS.CombineRgn (handle, handle, polyRgn, OS.RGN_OR);
     OS.DeleteObject (polyRgn);
@@ -467,7 +467,7 @@
 public void subtract (int[] pointArray) {
     if (isDisposed()) DWT.error(DWT.ERROR_GRAPHIC_DISPOSED);
     if (pointArray is null) DWT.error(DWT.ERROR_NULL_ARGUMENT);
-    if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
+    static if (OS.IsWinCE) DWT.error(DWT.ERROR_NOT_IMPLEMENTED);
     auto polyRgn = OS.CreatePolygonRgn(cast(POINT*)pointArray.ptr, pointArray.length / 2, OS.ALTERNATE);
     OS.CombineRgn (handle, handle, polyRgn, OS.RGN_DIFF);
     OS.DeleteObject (polyRgn);
--- a/dwt/internal/ImageList.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/internal/ImageList.d	Sun Feb 10 18:42:25 2008 -0800
@@ -34,7 +34,7 @@
 public this (int style) {
     this.style = style;
     int flags = OS.ILC_MASK;
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         flags |= OS.ILC_COLOR;
     } else {
         if (OS.COMCTL32_MAJOR >= 6) {
@@ -119,7 +119,7 @@
         *cast(BITMAPINFOHEADER*)bmi.ptr = bmiHeader;
         //OS.MoveMemory(bmi, bmiHeader, BITMAPINFOHEADER.sizeof);
         /* Set the rgb colors into the bitmap info */
-        if (OS.IsWinCE) {
+        static if (OS.IsWinCE) {
             int redMask = 0xFF00;
             int greenMask = 0xFF0000;
             int blueMask = 0xFF000000;
@@ -145,7 +145,7 @@
     }
     OS.SelectObject (hdc2, hBitmap);
     if (width !is bm.bmWidth || height !is bm.bmHeight) {
-        if (!OS.IsWinCE) OS.SetStretchBltMode(hdc2, OS.COLORONCOLOR);
+        static if (!OS.IsWinCE) OS.SetStretchBltMode(hdc2, OS.COLORONCOLOR);
         OS.StretchBlt (hdc2, 0, 0, width, height, hdc1, 0, 0, bm.bmWidth, bm.bmHeight, OS.SRCCOPY);
     } else {
         OS.BitBlt (hdc2, 0, 0, width, height, hdc1, 0, 0, OS.SRCCOPY);
@@ -241,7 +241,7 @@
         auto memDib2 = OS.CreateDIBSection (null, cast(BITMAPINFO*)bmi2.ptr, OS.DIB_RGB_COLORS, pBits2.ptr, null, 0);
         auto memHdc2 = OS.CreateCompatibleDC (hdc);
         auto oldMemBitmap2 = OS.SelectObject (memHdc2, memDib2);
-        if (!OS.IsWinCE) OS.SetStretchBltMode(memHdc2, OS.COLORONCOLOR);
+        static if (!OS.IsWinCE) OS.SetStretchBltMode(memHdc2, OS.COLORONCOLOR);
         OS.StretchBlt (memHdc2, 0, 0, destWidth, destHeight, memHdc, 0, 0, srcWidth, srcHeight, OS.SRCCOPY);
         OS.SelectObject (memHdc2, oldMemBitmap2);
         OS.DeleteDC (memHdc2);
@@ -279,7 +279,7 @@
         auto hdc2 = OS.CreateCompatibleDC (hdc);
         auto hMask2 = OS.CreateBitmap (destWidth, destHeight, 1, 1, null);
         OS.SelectObject (hdc2, hMask2);
-        if (!OS.IsWinCE) OS.SetStretchBltMode(hdc2, OS.COLORONCOLOR);
+        static if (!OS.IsWinCE) OS.SetStretchBltMode(hdc2, OS.COLORONCOLOR);
         OS.StretchBlt (hdc2, 0, 0, destWidth, destHeight, hdc1, 0, 0, srcWidth, srcHeight, OS.SRCCOPY);
         OS.DeleteDC (hdc1);
         OS.DeleteDC (hdc2);
@@ -330,7 +330,7 @@
         auto hdc2 = OS.CreateCompatibleDC (hDC);
         OS.SelectObject (hdc2, hMask);
         if (destWidth !is srcWidth || destHeight !is srcHeight) {
-            if (!OS.IsWinCE) OS.SetStretchBltMode (hdc2, OS.COLORONCOLOR);
+            static if (!OS.IsWinCE) OS.SetStretchBltMode (hdc2, OS.COLORONCOLOR);
             OS.StretchBlt (hdc2, 0, 0, destWidth, destHeight, hdc1, 0, 0, srcWidth, srcHeight, OS.SRCCOPY);
         } else {
             OS.BitBlt (hdc2, 0, 0, destWidth, destHeight, hdc1, 0, 0, OS.SRCCOPY);
@@ -447,7 +447,7 @@
             break;
         }
         case DWT.ICON: {
-            if (OS.IsWinCE) {
+            static if (OS.IsWinCE) {
                 OS.ImageList_ReplaceIcon (handle, index is count ? -1 : index, hImage);
             } else {
                 auto hIcon = copyIcon (hImage, cx, cy);
--- a/dwt/ole/win32/OleFrame.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/ole/win32/OleFrame.d	Sun Feb 10 18:42:25 2008 -0800
@@ -243,7 +243,7 @@
                     switch (msg.message) {
                         case OS.WM_KEYDOWN:
                         case OS.WM_SYSKEYDOWN: {
-                            if (!OS.IsWinCE) {
+                            static if (!OS.IsWinCE) {
                                 switch (msg.wParam) {
                                     case OS.VK_SHIFT:
                                     case OS.VK_MENU:
--- a/dwt/widgets/Canvas.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/widgets/Canvas.d	Sun Feb 10 18:42:25 2008 -0800
@@ -197,7 +197,7 @@
     RECT clientRect;
     OS.GetClientRect (handle, &clientRect);
     if (OS.IntersectRect (&clientRect, &sourceRect, &clientRect)) {
-        if (OS.IsWinCE) {
+        static if (OS.IsWinCE) {
             OS.UpdateWindow (handle);
         } else {
             int flags = OS.RDW_UPDATENOW | OS.RDW_ALLCHILDREN;
@@ -206,7 +206,7 @@
     }
     int deltaX = destX - x, deltaY = destY - y;
     if (findImageControl () !is null) {
-        if (OS.IsWinCE) {
+        static if (OS.IsWinCE) {
             OS.InvalidateRect (handle, &sourceRect, true);
         } else {
             int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE;
@@ -214,7 +214,7 @@
             OS.RedrawWindow (handle, &sourceRect, null, flags);
         }
         OS.OffsetRect (&sourceRect, deltaX, deltaY);
-        if (OS.IsWinCE) {
+        static if (OS.IsWinCE) {
             OS.InvalidateRect (handle, &sourceRect, true);
         } else {
             int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE;
--- a/dwt/widgets/Combo.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/widgets/Combo.d	Sun Feb 10 18:42:25 2008 -0800
@@ -1608,7 +1608,7 @@
  */
 public void setOrientation (int orientation) {
     checkWidget();
-    if (OS.IsWinCE) return;
+    static if (OS.IsWinCE) return;
     if (OS.WIN32_VERSION < OS.VERSION (4, 10)) return;
     int flags = DWT.RIGHT_TO_LEFT | DWT.LEFT_TO_RIGHT;
     if ((orientation & flags) is 0 || (orientation & flags) is flags) return;
@@ -2172,7 +2172,7 @@
     if ((style & DWT.SIMPLE) !is 0) {
         LRESULT result = super.WM_SIZE (wParam, lParam);
         if (OS.IsWindowVisible (handle)) {
-            if (OS.IsWinCE) {
+            static if (OS.IsWinCE) {
                 auto hwndText = OS.GetDlgItem (handle, CBID_EDIT);
                 if (hwndText !is null) OS.InvalidateRect (hwndText, null, true);
                 auto hwndList = OS.GetDlgItem (handle, CBID_LIST);
--- a/dwt/widgets/Composite.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/widgets/Composite.d	Sun Feb 10 18:42:25 2008 -0800
@@ -760,7 +760,7 @@
     if (threadId !is OS.GetCurrentThreadId ()) {
         if (processID is OS.GetCurrentProcessId ()) {
             if (display.msgHook is null) {
-                if (!OS.IsWinCE) {
+                static if (!OS.IsWinCE) {
                     //display.getMsgCallback = new Callback (display, "getMsgProc", 3);
                     //display.getMsgProc = display.getMsgCallback.getAddress ();
                     //if (display.getMsgProc is 0) error (DWT.ERROR_NO_MORE_CALLBACKS);
@@ -1137,7 +1137,7 @@
 
     /* Set the clipping bits */
     int oldBits = 0, newBits = 0;
-    if (!OS.IsWinCE) {
+    static if (!OS.IsWinCE) {
         oldBits = OS.GetWindowLong (handle, OS.GWL_STYLE);
         newBits = oldBits | OS.WS_CLIPSIBLINGS | OS.WS_CLIPCHILDREN;
         if (newBits !is oldBits) OS.SetWindowLong (handle, OS.GWL_STYLE, newBits);
@@ -1447,7 +1447,7 @@
     * does not redraw properly.  The fix is to detect this case and
     * redraw the non-client area.
     */
-    if (!OS.IsWinCE) {
+    static if (!OS.IsWinCE) {
         int cmd = wParam & 0xFFF0;
         switch (cmd) {
             case OS.SC_HSCROLL:
@@ -1502,7 +1502,7 @@
 }
 
 override LRESULT wmNotify (NMHDR* hdr, int wParam, int lParam) {
-    if (!OS.IsWinCE) {
+    static if (!OS.IsWinCE) {
         switch (hdr.code) {
             /*
             * Feature in Windows.  When the tool tip control is
--- a/dwt/widgets/CoolBar.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/widgets/CoolBar.d	Sun Feb 10 18:42:25 2008 -0800
@@ -760,7 +760,7 @@
     * to invalidate the coolbar area.
     */
     if (!OS.IsWindowVisible (handle)) return;
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         OS.InvalidateRect (handle, null, true);
     } else {
         int flags = OS.RDW_ERASE | OS.RDW_FRAME | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN;
--- a/dwt/widgets/Decorations.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/widgets/Decorations.d	Sun Feb 10 18:42:25 2008 -0800
@@ -182,7 +182,7 @@
 
 void _setMaximized (bool maximized) {
     swFlags = maximized ? OS.SW_SHOWMAXIMIZED : OS.SW_RESTORE;
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         /*
         * Note: WinCE does not support SW_SHOWMAXIMIZED and SW_RESTORE. The
         * workaround is to resize the window to fit the parent client area.
@@ -212,7 +212,7 @@
 }
 
 void _setMinimized (bool minimized) {
-    if (OS.IsWinCE) return;
+    static if (OS.IsWinCE) return;
     swFlags = minimized ? OS.SW_SHOWMINNOACTIVE : OS.SW_RESTORE;
     if (!OS.IsWindowVisible (handle)) return;
     if (minimized is OS.IsIconic (handle)) return;
@@ -260,7 +260,7 @@
     if ((style & DWT.NO_TRIM) !is 0) {
         style &= ~(DWT.CLOSE | DWT.TITLE | DWT.MIN | DWT.MAX | DWT.RESIZE | DWT.BORDER);
     }
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         /*
         * Feature in WinCE PPC.  WS_MINIMIZEBOX or WS_MAXIMIZEBOX
         * are not supposed to be used.  If they are, the result
@@ -456,7 +456,7 @@
     * process exits.
     */
     if ((state & FOREIGN_HANDLE) is 0) {
-        if (!OS.IsWinCE) {
+        static if (!OS.IsWinCE) {
             auto hIcon = OS.LoadIcon (null, cast(wchar*)OS.IDI_APPLICATION);
             OS.SendMessage (handle, OS.WM_SETICON, OS.ICON_SMALL, hIcon);
         }
@@ -520,7 +520,7 @@
 
 override public Rectangle getBounds () {
     checkWidget ();
-    if (!OS.IsWinCE) {
+    static if (!OS.IsWinCE) {
         if (OS.IsIconic (handle)) {
             WINDOWPLACEMENT lpwndpl;
             lpwndpl.length = WINDOWPLACEMENT.sizeof;
@@ -664,7 +664,7 @@
 
 override public Point getLocation () {
     checkWidget ();
-    if (!OS.IsWinCE) {
+    static if (!OS.IsWinCE) {
         if (OS.IsIconic (handle)) {
             WINDOWPLACEMENT lpwndpl;
             lpwndpl.length = WINDOWPLACEMENT.sizeof;
@@ -867,7 +867,7 @@
 }
 
 override void setBounds (int x, int y, int width, int height, int flags, bool defer) {
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         swFlags = OS.SW_RESTORE;
     } else {
         if (OS.IsIconic (handle)) {
@@ -988,7 +988,7 @@
     *
     * On WinCE PPC, icons in windows are not displayed.
     */
-    if (OS.IsWinCE) return;
+    static if (OS.IsWinCE) return;
     if (smallImage !is null) smallImage.dispose ();
     if (largeImage !is null) largeImage.dispose ();
     smallImage = largeImage = null;
@@ -1065,7 +1065,7 @@
     * trimmings do not redraw to hide the previous icon.
     * The fix is to force a redraw.
     */
-    if (!OS.IsWinCE) {
+    static if (!OS.IsWinCE) {
         if (hSmallIcon is null && hLargeIcon is null && (style & DWT.BORDER) !is 0) {
             int flags = OS.RDW_FRAME | OS.RDW_INVALIDATE;
             OS.RedrawWindow (handle, null, null, flags);
--- a/dwt/widgets/Display.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/widgets/Display.d	Sun Feb 10 18:42:25 2008 -0800
@@ -653,7 +653,7 @@
 }
 
 int asciiKey (int key) {
-    if (OS.IsWinCE) return 0;
+    static if (OS.IsWinCE) return 0;
 
     /* Get the current keyboard. */
     for (int i=0; i<keyboard.length; i++) keyboard [i] = 0;
@@ -1102,7 +1102,7 @@
         auto hdc2 = OS.CreateCompatibleDC (hdc);
         auto hMask2 = OS.CreateBitmap (destWidth, destHeight, 1, 1, null);
         OS.SelectObject (hdc2, hMask2);
-        if (!OS.IsWinCE) OS.SetStretchBltMode(hdc2, OS.COLORONCOLOR);
+        static if (!OS.IsWinCE) OS.SetStretchBltMode(hdc2, OS.COLORONCOLOR);
         OS.StretchBlt (hdc2, 0, 0, destWidth, destHeight, hdc1, 0, 0, srcWidth, srcHeight, OS.SRCCOPY);
         OS.DeleteDC (hdc1);
         OS.DeleteDC (hdc2);
@@ -2317,7 +2317,7 @@
     checkDevice ();
     if (systemFont !is null) return systemFont;
     HFONT hFont;
-    if (!OS.IsWinCE) {
+    static if (!OS.IsWinCE) {
         NONCLIENTMETRICS info;
         info.cbSize = NONCLIENTMETRICS.sizeof;
         if (OS.SystemParametersInfo (OS.SPI_GETNONCLIENTMETRICS, 0, &info, 0)) {
@@ -2401,7 +2401,7 @@
 public Tray getSystemTray () {
     checkDevice ();
     if (tray !is null) return tray;
-    if (!OS.IsWinCE) tray = new Tray (this, DWT.NONE);
+    static if (!OS.IsWinCE) tray = new Tray (this, DWT.NONE);
     return tray;
 }
 
@@ -2876,7 +2876,7 @@
                 switch (keyMsg.message) {
                     case OS.WM_KEYDOWN:
                     case OS.WM_SYSKEYDOWN: {
-                        if (!OS.IsWinCE) {
+                        static if (!OS.IsWinCE) {
                             switch (keyMsg.wParam) {
                                 case OS.VK_SHIFT:
                                 case OS.VK_MENU:
@@ -3248,7 +3248,7 @@
 //                  case DWT.LF: inputs.wVk = cast(short) OS.VK_RETURN; break;
                     case DWT.LF: return false;
                     default: {
-                        if (OS.IsWinCE) {
+                        static if (OS.IsWinCE) {
                             inputs.wVk = cast(int)OS.CharUpper (cast(wchar*) key);
                         } else {
                             inputs.wVk = OS.VkKeyScan (cast(short) wcsToMbcs (key, 0));
@@ -3492,7 +3492,7 @@
     }
 
     /* Unhook the idle hook */
-    if (!OS.IsWinCE) {
+    static if (!OS.IsWinCE) {
         if (idleHook !is null) OS.UnhookWindowsHookEx (idleHook);
         idleHook = null;
         //foregroundIdleCallback.dispose ();
@@ -3868,7 +3868,7 @@
         resources = newResources;
     }
     if (systemFont !is null) {
-        if (!OS.IsWinCE) {
+        static if (!OS.IsWinCE) {
             NONCLIENTMETRICS info;
             info.cbSize = NONCLIENTMETRICS.sizeof;
             if (OS.SystemParametersInfo (OS.SPI_GETNONCLIENTMETRICS, 0, &info, 0)) {
@@ -4137,7 +4137,7 @@
 }
 
 int shiftedKey (int key) {
-    if (OS.IsWinCE) return 0;
+    static if (OS.IsWinCE) return 0;
 
     /* Clear the virtual keyboard and press the shift key */
     for (int i=0; i<keyboard.length; i++) keyboard [i] = 0;
@@ -4402,7 +4402,7 @@
 }
 
 void wakeThread () {
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         OS.PostMessage (hwndMessage, OS.WM_NULL, 0, 0);
     } else {
         OS.PostThreadMessage (threadId, OS.WM_NULL, 0, 0);
--- a/dwt/widgets/FileDialog.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/widgets/FileDialog.d	Sun Feb 10 18:42:25 2008 -0800
@@ -354,13 +354,15 @@
         * Note: WinCE does not support multi-select file dialogs.
         */
         int nFileOffset = struct_.nFileOffset;
-        if (OS.IsWinCE && nFileOffset is 0) {
-            int index = 0;
-            while (index < buffer.length ) {
-                int ch = buffer[index];
-                if (ch is 0) break;
-                if (ch is '\\') nFileOffset = index + 1;
-                index++;
+        static if (OS.IsWinCE) {
+            if (nFileOffset is 0) {
+                int index = 0;
+                while (index < buffer.length ) {
+                    int ch = buffer[index];
+                    if (ch is 0) break;
+                    if (ch is '\\') nFileOffset = index + 1;
+                    index++;
+                }
             }
         }
         if (nFileOffset > 0) {
--- a/dwt/widgets/FontDialog.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/widgets/FontDialog.d	Sun Feb 10 18:42:25 2008 -0800
@@ -142,7 +142,7 @@
  * </ul>
  */
 public FontData open () {
-    if (OS.IsWinCE) DWT.error (DWT.ERROR_NOT_IMPLEMENTED);
+    static if (OS.IsWinCE) DWT.error (DWT.ERROR_NOT_IMPLEMENTED);
 
     /* Get the owner HWND for the dialog */
     HWND hwndOwner;
--- a/dwt/widgets/Group.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/widgets/Group.d	Sun Feb 10 18:42:25 2008 -0800
@@ -482,7 +482,7 @@
     * group from inside WM_SIZE causes pixel corruption for
     * radio button children.
     */
-    if (OS.IsWinCE) return result;
+    static if (OS.IsWinCE) return result;
     if (!OS.IsWindowVisible (handle)) return result;
     WINDOWPOS* lpwp = cast(WINDOWPOS*)lParam;
     //OS.MoveMemory (lpwp, lParam, WINDOWPOS.sizeof);
--- a/dwt/widgets/Label.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/widgets/Label.d	Sun Feb 10 18:42:25 2008 -0800
@@ -559,7 +559,7 @@
 }
 
 override LRESULT WM_PAINT (int wParam, int lParam) {
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         bool drawImage = image !is null;
         bool drawSeparator = (style & DWT.SEPARATOR) !is 0 && (style & DWT.SHADOW_NONE) is 0;
         if (drawImage || drawSeparator) {
--- a/dwt/widgets/Menu.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/widgets/Menu.d	Sun Feb 10 18:42:25 2008 -0800
@@ -540,7 +540,7 @@
 }
 
 void destroyItem (MenuItem item) {
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         if ((OS.IsPPC || OS.IsSP) && hwndCB !is null) {
             if (OS.IsSP) {
                 redraw();
@@ -586,8 +586,8 @@
     HMENU hMenu = handle;
     HWND hCB = hwndCB;
     releaseHandle ();
-    if (OS.IsWinCE && hCB !is null) {
-        static if( OS.IsWinCE ){
+    static if (OS.IsWinCE) {
+        if( hCB !is null ){
             OS.CommandBar_Destroy (hCB);
         }
     } else {
@@ -661,7 +661,7 @@
  */
 /*public*/ Rectangle getBounds () {
     checkWidget ();
-    if (OS.IsWinCE) return new Rectangle (0, 0, 0, 0);
+    static if (OS.IsWinCE) return new Rectangle (0, 0, 0, 0);
     if ((style & DWT.BAR) !is 0) {
         if (parent.menuBar !is this) {
             return new Rectangle (0, 0, 0, 0);
@@ -706,7 +706,7 @@
  */
 public MenuItem getDefaultItem () {
     checkWidget ();
-    if (OS.IsWinCE) return null;
+    static if (OS.IsWinCE) return null;
     int id = OS.GetMenuDefaultItem (handle, OS.MF_BYCOMMAND, OS.GMDI_USEDISABLED);
     if (id is -1) return null;
     MENUITEMINFO info;
@@ -866,7 +866,7 @@
 }
 
 int GetMenuItemCount (HANDLE handle) {
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         if ((OS.IsPPC || OS.IsSP) && hwndCB !is null) {
             return OS.IsSP ? 2 : OS.SendMessage (hwndCB, OS.TB_BUTTONCOUNT, 0, 0);
         }
@@ -1325,7 +1325,7 @@
         if (item.parent !is this) return;
         newID = item.id;
     }
-    if (OS.IsWinCE) return;
+    static if (OS.IsWinCE) return;
     int oldID = OS.GetMenuDefaultItem (handle, OS.MF_BYCOMMAND, OS.GMDI_USEDISABLED);
     if (newID is oldID) return;
     OS.SetMenuDefaultItem (handle, newID, OS.MF_BYCOMMAND);
@@ -1457,7 +1457,7 @@
         }
         return;
     }
-    if (OS.IsWinCE) return;
+    static if (OS.IsWinCE) return;
     if ((style & DWT.BAR) !is 0) {
         if (this is parent.menuBar) OS.DrawMenuBar (parent.handle);
         return;
--- a/dwt/widgets/MenuItem.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/widgets/MenuItem.d	Sun Feb 10 18:42:25 2008 -0800
@@ -361,7 +361,7 @@
  */
 /*public*/ Rectangle getBounds () {
     checkWidget ();
-    if (OS.IsWinCE) return new Rectangle (0, 0, 0, 0);
+    static if (OS.IsWinCE) return new Rectangle (0, 0, 0, 0);
     int index = parent.indexOf (this);
     if (index is -1) return new Rectangle (0, 0, 0, 0);
     if ((parent.style & DWT.BAR) !is 0) {
@@ -433,7 +433,7 @@
     info.cbSize = MENUITEMINFO.sizeof;
     info.fMask = OS.MIIM_STATE;
     bool success;
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         int index = parent.indexOf (this);
         if (index is -1) error (DWT.ERROR_CANNOT_GET_ENABLED);
         success = cast(bool) OS.GetMenuItemInfo (hMenu, index, true, &info);
--- a/dwt/widgets/MessageBox.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/widgets/MessageBox.d	Sun Feb 10 18:42:25 2008 -0800
@@ -143,7 +143,7 @@
 
     /* Only MB_APPLMODAL is supported on WinCE */
     int modalBits = 0;
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         if ((style & (DWT.PRIMARY_MODAL | DWT.APPLICATION_MODAL | DWT.SYSTEM_MODAL)) !is 0) {
             modalBits = OS.MB_APPLMODAL;
         }
--- a/dwt/widgets/Sash.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/widgets/Sash.d	Sun Feb 10 18:42:25 2008 -0800
@@ -313,7 +313,7 @@
         lastY = event.y;
         menuShell ().bringToTop ();
         if (isDisposed ()) return LRESULT.ZERO;
-        if (OS.IsWinCE) {
+        static if (OS.IsWinCE) {
             OS.UpdateWindow (hwndTrack);
         } else {
             int flags = OS.RDW_UPDATENOW | OS.RDW_ALLCHILDREN;
@@ -400,7 +400,7 @@
         lastX = event.x;
         lastY = event.y;
     }
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         OS.UpdateWindow (hwndTrack);
     } else {
         int flags = OS.RDW_UPDATENOW | OS.RDW_ALLCHILDREN;
--- a/dwt/widgets/ScrollBar.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/widgets/ScrollBar.d	Sun Feb 10 18:42:25 2008 -0800
@@ -828,7 +828,7 @@
     * hide the scroll bar when the page size is equal to
     * the range.
     */
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         SCROLLINFO info;
         info.cbSize = SCROLLINFO.sizeof;
         auto hwnd = hwndScrollBar ();
--- a/dwt/widgets/Shell.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/widgets/Shell.d	Sun Feb 10 18:42:25 2008 -0800
@@ -479,31 +479,31 @@
     return balloonTipHandle_;
 }
 
-override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
-    if (handle is null) return 0;
+override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
+    if (handle is null) return LRESULT.ZERO;
     if (hwnd is toolTipHandle_ || hwnd is balloonTipHandle_) {
-        return OS.CallWindowProc (ToolTipProc, hwnd, msg, wParam, lParam);
+        return cast(LRESULT) ToolTipProc( hwnd, msg, wParam, lParam);
     }
     if (hwndMDIClient_ !is null) {
-        return OS.DefFrameProc (hwnd, hwndMDIClient_, msg, wParam, lParam);
+        return cast(LRESULT) OS.DefFrameProc (hwnd, hwndMDIClient_, msg, wParam, lParam);
     }
     if (windowProc_ !is null) {
-        return OS.CallWindowProc (windowProc_, hwnd, msg, wParam, lParam);
+        return cast(LRESULT) windowProc_( hwnd, msg, wParam, lParam);
     }
     if ((style & DWT.TOOL) !is 0) {
         int trim = DWT.TITLE | DWT.CLOSE | DWT.MIN | DWT.MAX | DWT.BORDER | DWT.RESIZE;
-        if ((style & trim) is 0) return OS.DefWindowProc (hwnd, msg, wParam, lParam);
+        if ((style & trim) is 0) return cast(LRESULT) OS.DefWindowProc (hwnd, msg, wParam, lParam);
     }
     if (parent !is null) {
         switch (msg) {
             case OS.WM_KILLFOCUS:
             case OS.WM_SETFOCUS:
-                return OS.DefWindowProc (hwnd, msg, wParam, lParam);
+                return cast(LRESULT) OS.DefWindowProc (hwnd, msg, wParam, lParam);
             default:
         }
-        return OS.CallWindowProc (DialogProc, hwnd, msg, wParam, lParam);
+        return cast(LRESULT) DialogProc( hwnd, msg, wParam, lParam);
     }
-    return OS.DefWindowProc (hwnd, msg, wParam, lParam);
+    return cast(LRESULT) OS.DefWindowProc (hwnd, msg, wParam, lParam);
 }
 
 /**
@@ -586,7 +586,7 @@
     if (!embedded) {
         int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
         bits &= ~(OS.WS_OVERLAPPED | OS.WS_CAPTION);
-        if (!OS.IsWinCE) bits |= OS.WS_POPUP;
+        static if (!OS.IsWinCE) bits |= OS.WS_POPUP;
         if ((style & DWT.TITLE) !is 0) bits |= OS.WS_CAPTION;
         if ((style & DWT.NO_TRIM) is 0) {
             if ((style & (DWT.BORDER | DWT.RESIZE)) is 0) bits |= OS.WS_BORDER;
@@ -624,7 +624,7 @@
     }
     toolTips [id] = toolTip;
     toolTip.id = id + Display.ID_START;
-    if (OS.IsWinCE) return;
+    static if (OS.IsWinCE) return;
     TOOLINFO lpti;
     lpti.cbSize = TOOLINFO.sizeof;
     lpti.hwnd = handle;
@@ -670,7 +670,7 @@
 void destroyToolTip (ToolTip toolTip) {
     if (toolTips is null) return;
     toolTips [toolTip.id - Display.ID_START] = null;
-    if (OS.IsWinCE) return;
+    static if (OS.IsWinCE) return;
     if (balloonTipHandle_ !is null) {
         TOOLINFO lpti;
         lpti.cbSize = TOOLINFO.sizeof;
@@ -866,7 +866,7 @@
 
 override public Rectangle getBounds () {
     checkWidget ();
-    if (!OS.IsWinCE) {
+    static if (!OS.IsWinCE) {
         if (OS.IsIconic (handle)) return super.getBounds ();
     }
     RECT rect;
@@ -1014,7 +1014,7 @@
 
 override public Point getSize () {
     checkWidget ();
-    if (!OS.IsWinCE) {
+    static if (!OS.IsWinCE) {
         if (OS.IsIconic (handle)) return super.getSize ();
     }
     RECT rect;
@@ -1127,7 +1127,7 @@
     * The workaround is to explicitly force the shell to
     * be the foreground window.
     */
-    if (OS.IsWinCE) OS.SetForegroundWindow (handle);
+    static if (OS.IsWinCE) OS.SetForegroundWindow (handle);
     OS.SendMessage (handle, OS.WM_CHANGEUISTATE, OS.UIS_INITIALIZE, 0);
     setVisible (true);
     if (isDisposed ()) return;
@@ -1503,7 +1503,7 @@
 }
 
 void setToolTipText (HWND hwnd, char[] text) {
-    if (OS.IsWinCE) return;
+    static if (OS.IsWinCE) return;
     TOOLINFO lpti;
     lpti.cbSize = TOOLINFO.sizeof;
     lpti.hwnd = handle;
@@ -1652,7 +1652,7 @@
     * to hide children before hiding the parent.
     */
     if (showWithParent && !visible) {
-        if (!OS.IsWinCE) OS.ShowOwnedPopups (handle, false);
+        static if (!OS.IsWinCE) OS.ShowOwnedPopups (handle, false);
     }
     if (!visible) fixActiveShell ();
     super.setVisible (visible);
@@ -1660,7 +1660,7 @@
     if (showWithParent is visible) return;
     showWithParent = visible;
     if (visible) {
-        if (!OS.IsWinCE) OS.ShowOwnedPopups (handle, true);
+        static if (!OS.IsWinCE) OS.ShowOwnedPopups (handle, true);
     }
 }
 
@@ -1734,7 +1734,7 @@
     * even when it has no title.  The fix is to use WS_EX_TOOLWINDOW
     * which does not cause the window to appear in the Task Bar.
     */
-    if (!OS.IsWinCE) {
+    static if (!OS.IsWinCE) {
         if (parent is null) {
             if ((style & DWT.ON_TOP) !is 0) {
                 int trim = DWT.TITLE | DWT.CLOSE | DWT.MIN | DWT.MAX;
@@ -1957,7 +1957,7 @@
 
 override LRESULT WM_ERASEBKGND (int wParam, int lParam) {
     LRESULT result = super.WM_ERASEBKGND (wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     /*
     * Feature in Windows.  When a shell is resized by dragging
     * the resize handles, Windows temporarily fills in black
@@ -1975,16 +1975,18 @@
 
 override LRESULT WM_ENTERIDLE (int wParam, int lParam) {
     LRESULT result = super.WM_ENTERIDLE (wParam, lParam);
-    if (result !is null) return result;
-    if (OS.IsWinCE && display.runMessages) {
-        if (display.runAsyncMessages (true)) display.wakeThread ();
+    if (result !is LRESULT.NULL) return result;
+    static if (OS.IsWinCE) {
+        if (display.runMessages) {
+            if (display.runAsyncMessages (true)) display.wakeThread ();
+        }
     }
     return result;
 }
 
 override LRESULT WM_GETMINMAXINFO (int wParam, int lParam) {
     LRESULT result = super.WM_GETMINMAXINFO (wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     if (minWidth !is DWT.DEFAULT || minHeight !is DWT.DEFAULT) {
         MINMAXINFO* info = cast(MINMAXINFO*)lParam;
         //OS.MoveMemory (info, lParam, MINMAXINFO.sizeof);
@@ -1998,7 +2000,7 @@
 
 override LRESULT WM_MOUSEACTIVATE (int wParam, int lParam) {
     LRESULT result = super.WM_MOUSEACTIVATE (wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
 
     /*
     * Check for WM_MOUSEACTIVATE when an MDI shell is active
@@ -2021,17 +2023,17 @@
                     display.lastHittestControl = null;
                     if (hittest is OS.HTMENU || hittest is OS.HTSYSMENU) {
                         display.lastHittestControl = control;
-                        return null;
+                        return LRESULT.NULL;
                     }
                     if (OS.IsWin95 && hittest is OS.HTCAPTION) {
                         display.lastHittestControl = control;
                     }
-                    return new LRESULT (OS.MA_NOACTIVATE);
+                    return cast( LRESULT )(OS.MA_NOACTIVATE);
                 }
             }
         }
     }
-    if (hittest is OS.HTMENU) return null;
+    if (hittest is OS.HTMENU) return LRESULT.NULL;
 
     /*
     * Get the current location of the cursor,
@@ -2052,7 +2054,7 @@
         pt.y = cast(short) (pos >> 16);
     }
     auto hwnd = OS.WindowFromPoint (pt);
-    if (hwnd is null) return null;
+    if (hwnd is null) return LRESULT.NULL;
     Control control = display.findControl (hwnd);
 
     /*
@@ -2066,19 +2068,19 @@
             int bits = DWT.ON_TOP | DWT.NO_FOCUS;
             if ((style & bits) is bits) {
                 if (hittest is OS.HTBORDER || hittest is OS.HTCLIENT) {
-                    return new LRESULT (OS.MA_NOACTIVATE);
+                    return cast( LRESULT )(OS.MA_NOACTIVATE);
                 }
             }
         }
     }
 
     setActiveControl (control);
-    return null;
+    return LRESULT.NULL;
 }
 
 override LRESULT WM_MOVE (int wParam, int lParam) {
     LRESULT result = super.WM_MOVE (wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     ToolTip tip = getCurrentToolTip ();
     if (tip !is null) tip.setVisible (false);
     return result;
@@ -2101,24 +2103,24 @@
 }
 
 override LRESULT WM_NCHITTEST (int wParam, int lParam) {
-    if (!OS.IsWindowEnabled (handle)) return null;
+    if (!OS.IsWindowEnabled (handle)) return LRESULT.NULL;
     if (!isEnabled () || !isActive ()) {
-        if (!Display.TrimEnabled) return new LRESULT (OS.HTNOWHERE);
+        if (!Display.TrimEnabled) return cast( LRESULT )(OS.HTNOWHERE);
         int hittest = callWindowProc (handle, OS.WM_NCHITTEST, wParam, lParam);
         if (hittest is OS.HTCLIENT || hittest is OS.HTMENU) hittest = OS.HTBORDER;
-        return new LRESULT (hittest);
+        return cast( LRESULT )(hittest);
     }
     if (menuBar !is null && !menuBar.getEnabled ()) {
         int hittest = callWindowProc (handle, OS.WM_NCHITTEST, wParam, lParam);
         if (hittest is OS.HTMENU) hittest = OS.HTBORDER;
-        return new LRESULT (hittest);
+        return cast( LRESULT )(hittest);
     }
-    return null;
+    return LRESULT.NULL;
 }
 
 override LRESULT WM_NCLBUTTONDOWN (int wParam, int lParam) {
     LRESULT result = super.WM_NCLBUTTONDOWN (wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     /*
     * When the normal activation was interrupted in WM_MOUSEACTIVATE
     * because the active shell was an MDI shell, set the active window
@@ -2141,7 +2143,7 @@
     }
     display.lastHittestControl = null;
     display.ignoreRestoreFocus = false;
-    return new LRESULT (code);
+    return cast( LRESULT )(code);
 }
 
 override LRESULT WM_PALETTECHANGED (int wParam, int lParam) {
@@ -2234,7 +2236,7 @@
 
 override LRESULT WM_SETTINGCHANGE (int wParam, int lParam) {
     LRESULT result = super.WM_SETTINGCHANGE (wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     static if (OS.IsPPC) {
         if (wParam is OS.SPI_SETSIPINFO) {
             /*
@@ -2259,7 +2261,7 @@
 
 override LRESULT WM_SHOWWINDOW (int wParam, int lParam) {
     LRESULT result = super.WM_SHOWWINDOW (wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     /*
     * Bug in Windows.  If the shell is hidden while the parent
     * is iconic,  Windows shows the shell when the parent is
@@ -2281,7 +2283,7 @@
 
 override LRESULT WM_SYSCOMMAND (int wParam, int lParam) {
     LRESULT result = super.WM_SYSCOMMAND (wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     /*
     * Feature in Windows.  When the last visible window in
     * a process minimized, Windows swaps out the memory for
@@ -2316,7 +2318,7 @@
 
 override LRESULT WM_WINDOWPOSCHANGING (int wParam, int lParam) {
     LRESULT result = super.WM_WINDOWPOSCHANGING (wParam,lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     auto lpwp = cast(WINDOWPOS*)lParam;
     //OS.MoveMemory (lpwp, lParam, WINDOWPOS.sizeof);
     if ((lpwp.flags & OS.SWP_NOSIZE) is 0) {
--- a/dwt/widgets/Slider.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/widgets/Slider.d	Sun Feb 10 18:42:25 2008 -0800
@@ -242,7 +242,7 @@
 
 override void enableWidget (bool enabled) {
     super.enableWidget (enabled);
-    if (!OS.IsWinCE) {
+    static if (!OS.IsWinCE) {
         int flags = enabled ? OS.ESB_ENABLE_BOTH : OS.ESB_DISABLE_BOTH;
         OS.EnableScrollBar (handle, OS.SB_CTL, flags);
     }
@@ -511,7 +511,7 @@
     bool result = cast(bool) OS.SetScrollInfo (hwnd, flags, info, fRedraw);
     if ((state & DISABLED) !is 0) {
         OS.EnableWindow (handle, false);
-        if (!OS.IsWinCE) {
+        static if (!OS.IsWinCE) {
             OS.EnableScrollBar (handle, OS.SB_CTL, OS.ESB_DISABLE_BOTH);
         }
     }
@@ -702,7 +702,7 @@
     * is consumed.  The fix is to send a fake mouse up and
     * release the automatic capture.
     */
-    if (!OS.IsWinCE) {
+    static if (!OS.IsWinCE) {
         if (OS.GetCapture () is handle) OS.ReleaseCapture ();
         if (!sendMouseEvent (DWT.MouseUp, 1, handle, OS.WM_LBUTTONUP, wParam, lParam)) {
             return LRESULT.ZERO;
@@ -735,7 +735,7 @@
     * is consumed.  The fix is to send a fake mouse up and
     * release the automatic capture.
     */
-    if (!OS.IsWinCE) {
+    static if (!OS.IsWinCE) {
         if (OS.GetCapture () is handle) OS.ReleaseCapture ();
         if (!sendMouseEvent (DWT.MouseUp, 1, handle, OS.WM_LBUTTONUP, wParam, lParam)) {
             return LRESULT.ONE;
--- a/dwt/widgets/Spinner.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/widgets/Spinner.d	Sun Feb 10 18:42:25 2008 -0800
@@ -538,7 +538,7 @@
  */
 public int getSelection () {
     checkWidget ();
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         return OS.SendMessage (hwndUpDown, OS.UDM_GETPOS, 0, 0) & 0xFFFF;
     } else {
         return OS.SendMessage (hwndUpDown, OS.UDM_GETPOS32, 0, 0);
@@ -817,7 +817,7 @@
     if (value is this.digits) return;
     this.digits = value;
     int pos;
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         pos = OS.SendMessage (hwndUpDown, OS.UDM_GETPOS, 0, 0) & 0xFFFF;
     } else {
         pos = OS.SendMessage (hwndUpDown, OS.UDM_GETPOS32, 0, 0);
@@ -882,7 +882,7 @@
     OS.SendMessage (hwndUpDown , OS.UDM_GETRANGE32, &min, null);
     if (value <= min) return;
     int pos;
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         pos = OS.SendMessage (hwndUpDown, OS.UDM_GETPOS, 0, 0) & 0xFFFF;
     } else {
         pos = OS.SendMessage (hwndUpDown, OS.UDM_GETPOS32, 0, 0);
@@ -911,7 +911,7 @@
     OS.SendMessage (hwndUpDown , OS.UDM_GETRANGE32, null, &max);
     if (value >= max) return;
     int pos;
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         pos = OS.SendMessage (hwndUpDown, OS.UDM_GETPOS, 0, 0) & 0xFFFF;
     } else {
         pos = OS.SendMessage (hwndUpDown, OS.UDM_GETPOS32, 0, 0);
@@ -1277,7 +1277,7 @@
             int value = getSelectionText ();
             if (value !is -1) {
                 int pos;
-                if (OS.IsWinCE) {
+                static if (OS.IsWinCE) {
                     pos = OS.SendMessage (hwndUpDown, OS.UDM_GETPOS, 0, 0) & 0xFFFF;
                 } else {
                     pos = OS.SendMessage (hwndUpDown, OS.UDM_GETPOS32, 0, 0);
@@ -1310,7 +1310,7 @@
     if (delta !is 0) {
         int value = getSelectionText ();
         if (value !is -1) {
-            if (OS.IsWinCE) {
+            static if (OS.IsWinCE) {
                 value = OS.SendMessage (hwndUpDown, OS.UDM_GETPOS, 0, 0) & 0xFFFF;
             } else {
                 value = OS.SendMessage (hwndUpDown, OS.UDM_GETPOS32, 0, 0);
@@ -1340,7 +1340,7 @@
 override LRESULT wmKillFocus (HWND hwnd, int wParam, int lParam) {
     int value = getSelectionText ();
     if (value is -1) {
-        if (OS.IsWinCE) {
+        static if (OS.IsWinCE) {
             value = OS.SendMessage (hwndUpDown, OS.UDM_GETPOS, 0, 0) & 0xFFFF;
         } else {
             value = OS.SendMessage (hwndUpDown, OS.UDM_GETPOS32, 0, 0);
--- a/dwt/widgets/Table.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/widgets/Table.d	Sun Feb 10 18:42:25 2008 -0800
@@ -497,7 +497,7 @@
                 int dwExStyle = OS.SendMessage (handle, OS.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
                 if ((dwExStyle & OS.LVS_EX_FULLROWSELECT) is 0) {
                     int bits = OS.LVS_EX_FULLROWSELECT;
-                    if (OS.IsWinCE) {
+                    static if (OS.IsWinCE) {
                         RECT rect;
                         bool damaged = cast(bool) OS.GetUpdateRect (handle, &rect, true);
                         OS.SendMessage (handle, OS.LVM_SETEXTENDEDLISTVIEWSTYLE, bits, bits);
@@ -536,7 +536,7 @@
                 int dwExStyle = OS.SendMessage (handle, OS.LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
                 if ((dwExStyle & OS.LVS_EX_FULLROWSELECT) !is 0) {
                     int bits = OS.LVS_EX_FULLROWSELECT;
-                    if (OS.IsWinCE) {
+                    static if (OS.IsWinCE) {
                         RECT rect;
                         bool damaged = cast(bool) OS.GetUpdateRect (handle, &rect, true);
                         OS.SendMessage (handle, OS.LVM_SETEXTENDEDLISTVIEWSTYLE, bits, 0);
@@ -3712,7 +3712,7 @@
             if (hooks (DWT.MeasureItem) || hooks (DWT.EraseItem) || hooks (DWT.PaintItem)) {
                 if (--drawCount is 0 /*&& OS.IsWindowVisible (handle)*/) {
                     OS.DefWindowProc (handle, OS.WM_SETREDRAW, 1, 0);
-                    if (OS.IsWinCE) {
+                    static if (OS.IsWinCE) {
                         auto hwndHeader = cast(HWND) OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0);
                         if (hwndHeader !is null) OS.InvalidateRect (hwndHeader, null, true);
                         OS.InvalidateRect (handle, null, true);
@@ -3740,7 +3740,7 @@
 void setCheckboxImageList (int width, int height, bool fixScroll) {
     if ((style & DWT.CHECK) is 0) return;
     int count = 4, flags = 0;
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         flags |= OS.ILC_COLOR;
     } else {
         auto hDC = OS.GetDC (handle);
@@ -4184,7 +4184,7 @@
                 state &= ~HIDDEN;
                 OS.ShowWindow (handle, OS.SW_HIDE);
             } else {
-                if (OS.IsWinCE) {
+                static if (OS.IsWinCE) {
                     OS.InvalidateRect (handle, null, false);
                     if (hwndHeader !is null) {
                         OS.InvalidateRect (hwndHeader, null, false);
@@ -4331,7 +4331,7 @@
             OS.SendMessage (handle, OS.LVM_SETCOLUMNWIDTH, 0, newWidth);
             if (redraw) {
                 OS.DefWindowProc (handle, OS.WM_SETREDRAW, 1, 0);
-                if (OS.IsWinCE) {
+                static if (OS.IsWinCE) {
                     auto hwndHeader = cast(HWND) OS.SendMessage (handle, OS.LVM_GETHEADER, 0, 0);
                     if (hwndHeader !is null) OS.InvalidateRect (hwndHeader, null, true);
                     OS.InvalidateRect (handle, null, true);
@@ -5081,7 +5081,7 @@
                 if (index !is -1) {
                     TableItem item = _getItem (index);
                     item.setChecked (!item.getChecked (), true);
-                    if (!OS.IsWinCE) {
+                    static if (!OS.IsWinCE) {
                         OS.NotifyWinEvent (OS.EVENT_OBJECT_FOCUS, handle, OS.OBJID_CLIENT, index + 1);
                     }
                 }
@@ -5278,7 +5278,7 @@
         if (index !is -1 && pinfo.flags is OS.LVHT_ONITEMSTATEICON) {
             TableItem item = _getItem (index);
             item.setChecked (!item.getChecked (), true);
-            if (!OS.IsWinCE) {
+            static if (!OS.IsWinCE) {
                 OS.NotifyWinEvent (OS.EVENT_OBJECT_FOCUS, handle, OS.OBJID_CLIENT, index + 1);
             }
         }
@@ -5314,7 +5314,7 @@
         if (index !is -1 && pinfo.flags is OS.LVHT_ONITEMSTATEICON) {
             TableItem item = _getItem (index);
             item.setChecked (!item.getChecked (), true);
-            if (!OS.IsWinCE) {
+            static if (!OS.IsWinCE) {
                 OS.NotifyWinEvent (OS.EVENT_OBJECT_FOCUS, handle, OS.OBJID_CLIENT, index + 1);
             }
         }
--- a/dwt/widgets/Text.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/widgets/Text.d	Sun Feb 10 18:42:25 2008 -0800
@@ -1638,7 +1638,7 @@
  */
 public void setOrientation (int orientation) {
     checkWidget();
-    if (OS.IsWinCE) return;
+    static if (OS.IsWinCE) return;
     if (OS.WIN32_VERSION < OS.VERSION (4, 10)) return;
     int flags = DWT.RIGHT_TO_LEFT | DWT.LEFT_TO_RIGHT;
     if ((orientation & flags) is 0 || (orientation & flags) is flags) return;
--- a/dwt/widgets/ToolBar.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/widgets/ToolBar.d	Sun Feb 10 18:42:25 2008 -0800
@@ -390,7 +390,7 @@
 }
 
 override int defaultBackground () {
-    if (OS.IsWinCE) return OS.GetSysColor (OS.COLOR_BTNFACE);
+    static if (OS.IsWinCE) return OS.GetSysColor (OS.COLOR_BTNFACE);
     return super.defaultBackground ();
 }
 
@@ -1379,7 +1379,7 @@
             }
             break;
         case OS.TBN_HOTITEMCHANGE:
-            if (!OS.IsWinCE) {
+            static if (!OS.IsWinCE) {
                 auto lpnmhi = cast(NMTBHOTITEM*)lParam;
                 //OS.MoveMemory (lpnmhi, lParam, NMTBHOTITEM.sizeof);
                 switch (lpnmhi.dwFlags) {
--- a/dwt/widgets/ToolTip.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/widgets/ToolTip.d	Sun Feb 10 18:42:25 2008 -0800
@@ -220,7 +220,7 @@
  */
 public bool getVisible () {
     checkWidget();
-    if (OS.IsWinCE) return false;
+    static if (OS.IsWinCE) return false;
     if (item !is null) return visible;
     auto hwndToolTip_ = hwndToolTip ();
     if (OS.SendMessage (hwndToolTip_, OS.TTM_GETCURRENTTOOL, 0, 0) !is 0) {
@@ -447,7 +447,7 @@
  */
 public void setVisible (bool visible) {
     checkWidget ();
-    if (OS.IsWinCE) return;
+    static if (OS.IsWinCE) return;
     if (visible is getVisible ()) return;
     if (item is null) {
         auto hwnd = parent.handle;
--- a/dwt/widgets/Tree.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/widgets/Tree.d	Sun Feb 10 18:42:25 2008 -0800
@@ -242,7 +242,7 @@
                 */
                 int count = OS.SendMessage (handle, OS.TVM_GETCOUNT, 0, 0);
                 if (count !is 0 && (bits & OS.TVS_NOHSCROLL) !is 0) {
-                    if (!OS.IsWinCE) OS.ShowScrollBar (handle, OS.SB_HORZ, false);
+                    static if (!OS.IsWinCE) OS.ShowScrollBar (handle, OS.SB_HORZ, false);
                 }
             }
             break;
@@ -1903,7 +1903,7 @@
     * not have the problem).  This is the recommended work
     * around from the MSDN.
     */
-    if (!OS.IsWinCE) {
+    static if (!OS.IsWinCE) {
         if (OS.COMCTL32_MAJOR < 6) {
             OS.SendMessage (handle, OS.CCM_SETVERSION, 5, 0);
         }
@@ -1929,7 +1929,7 @@
 }
 
 void createHeaderToolTips () {
-    if (OS.IsWinCE) return;
+    static if (OS.IsWinCE) return;
     if (headerToolTipHandle !is null) return;
     headerToolTipHandle = OS.CreateWindowEx (
         0,
@@ -2052,7 +2052,7 @@
         */
         int count = OS.SendMessage (handle, OS.TVM_GETCOUNT, 0, 0);
         if (count !is 0) {
-            if (!OS.IsWinCE) OS.ShowScrollBar (handle, OS.SB_HORZ, false);
+            static if (!OS.IsWinCE) OS.ShowScrollBar (handle, OS.SB_HORZ, false);
         }
     }
     setScrollWidth ();
@@ -2189,7 +2189,7 @@
                     RECT damageRect;
                     bool damaged = cast(bool) OS.GetUpdateRect (handle, &damageRect, true);
                     if (damaged && damageRect.top < rect.bottom) {
-                        if (OS.IsWinCE) {
+                        static if (OS.IsWinCE) {
                             OS.OffsetRect (&damageRect, 0, rect.bottom - rect.top);
                             OS.InvalidateRect (handle, &damageRect, true);
                         } else {
@@ -2210,7 +2210,7 @@
 }
 
 void createItemToolTips () {
-    if (OS.IsWinCE) return;
+    static if (OS.IsWinCE) return;
     if (itemToolTipHandle !is null) return;
     int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
     bits |= OS.TVS_NOTOOLTIPS;
@@ -3397,7 +3397,7 @@
         HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
         if (hItem is null) return 0;
         int state = 0;
-        if (OS.IsWinCE) {
+        static if (OS.IsWinCE) {
             TVITEM tvItem;
             tvItem.hItem = hItem;
             tvItem.mask = OS.TVIF_STATE;
@@ -3694,7 +3694,7 @@
         HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0);
         if (hItem !is null) {
             TVITEM tvItem;
-            if (OS.IsWinCE) {
+            static if (OS.IsWinCE) {
                 //tvItem = new TVITEM ();
                 tvItem.mask = OS.TVIF_STATE;
             }
@@ -4272,7 +4272,7 @@
 void setCheckboxImageList () {
     if ((style & DWT.CHECK) is 0) return;
     int count = 5, flags = 0;
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         flags |= OS.ILC_COLOR;
     } else {
         if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
@@ -4982,7 +4982,7 @@
         hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
         if (hItem is null) return;
         int state = 0;
-        if (OS.IsWinCE) {
+        static if (OS.IsWinCE) {
             TVITEM tvItem;
             tvItem.hItem = hItem;
             tvItem.mask = OS.TVIF_STATE;
@@ -5011,7 +5011,7 @@
                 TreeItem item = items [index];
                 if (item !is null) {
                     int state = 0;
-                    if (OS.IsWinCE) {
+                    static if (OS.IsWinCE) {
                         tvItem.hItem = item.handle;
                         OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
                         state = tvItem.state;
@@ -5470,7 +5470,7 @@
                     }
                     tvItem.state = state << 12;
                     OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
-                    if (!OS.IsWinCE) {
+                    static if (!OS.IsWinCE) {
                         int id = cast(int) hItem;
                         if (OS.COMCTL32_MAJOR >= 6) {
                             id = OS.SendMessage (handle, OS.TVM_MAPHTREEITEMTOACCID, hItem, 0);
@@ -5789,7 +5789,7 @@
                 }
                 tvItem.state = state << 12;
                 OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
-                if (!OS.IsWinCE) {
+                static if (!OS.IsWinCE) {
                     int id = cast(int) tvItem.hItem;
                     if (OS.COMCTL32_MAJOR >= 6) {
                         id = OS.SendMessage (handle, OS.TVM_MAPHTREEITEMTOACCID, tvItem.hItem, 0);
@@ -5909,7 +5909,7 @@
             }
             tvItem.state = state << 12;
             OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
-            if (!OS.IsWinCE) {
+            static if (!OS.IsWinCE) {
                 int id = cast(int) tvItem.hItem;
                 if (OS.COMCTL32_MAJOR >= 6) {
                     id = OS.SendMessage (handle, OS.TVM_MAPHTREEITEMTOACCID, tvItem.hItem, 0);
@@ -6490,7 +6490,7 @@
     */
     int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
     if ((bits & OS.TVS_NOHSCROLL) !is 0) {
-        if (!OS.IsWinCE) OS.ShowScrollBar (handle, OS.SB_HORZ, false);
+        static if (!OS.IsWinCE) OS.ShowScrollBar (handle, OS.SB_HORZ, false);
     }
     /*
     * Bug in Windows.  On Vista, when the Explorer theme
@@ -6545,7 +6545,7 @@
 
 override LRESULT wmNotify (NMHDR* hdr, int wParam, int lParam) {
     if (hdr.hwndFrom is itemToolTipHandle && hwndHeader !is null) {
-        if (!OS.IsWinCE) {
+        static if (!OS.IsWinCE) {
             switch (hdr.code) {
                 case OS.TTN_POP: {
                     if (display.isXMouseActive ()) {
--- a/dwt/widgets/TreeItem.d	Mon Feb 11 02:49:42 2008 +0100
+++ b/dwt/widgets/TreeItem.d	Sun Feb 10 18:42:25 2008 -0800
@@ -594,7 +594,7 @@
     checkWidget ();
     auto hwnd = parent.handle;
     int state = 0;
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         TVITEM tvItem;
         tvItem.hItem = handle;
         tvItem.mask = OS.TVIF_STATE;
@@ -1206,7 +1206,7 @@
         return;
     }
     int state = 0;
-    if (OS.IsWinCE) {
+    static if (OS.IsWinCE) {
         TVITEM tvItem;
         tvItem.hItem = handle;
         tvItem.mask = OS.TVIF_STATE;
@@ -1382,7 +1382,7 @@
                     }
                 }
             } else {
-                if (OS.IsWinCE) {
+                static if (OS.IsWinCE) {
                     OS.InvalidateRect (topHandle, null, true);
                     if (hwnd !is topHandle) OS.InvalidateRect (hwnd, null, true);
                 } else {