changeset 108:6f75fdfa1bcd

Change LRESULT to class, like done in the old DWT.
author Frank Benoit <benoit@tionex.de>
date Mon, 11 Feb 2008 02:44:32 +0100
parents e4a62cdcd2e0
children 0a02d6d3466b
files dwt/internal/win32/OS.d dwt/widgets/Button.d dwt/widgets/Canvas.d dwt/widgets/Combo.d dwt/widgets/Composite.d dwt/widgets/Control.d dwt/widgets/CoolBar.d dwt/widgets/Decorations.d dwt/widgets/ExpandBar.d dwt/widgets/Group.d dwt/widgets/Label.d dwt/widgets/Link.d dwt/widgets/List.d dwt/widgets/MenuItem.d dwt/widgets/ProgressBar.d dwt/widgets/Sash.d dwt/widgets/Scale.d dwt/widgets/ScrollBar.d dwt/widgets/Scrollable.d dwt/widgets/Shell.d dwt/widgets/Slider.d dwt/widgets/Spinner.d dwt/widgets/TabFolder.d dwt/widgets/Table.d dwt/widgets/Text.d dwt/widgets/ToolBar.d dwt/widgets/ToolItem.d dwt/widgets/Tracker.d dwt/widgets/Tree.d dwt/widgets/Widget.d
diffstat 30 files changed, 588 insertions(+), 585 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/internal/win32/OS.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/internal/win32/OS.d	Mon Feb 11 02:44:32 2008 +0100
@@ -67,6 +67,13 @@
 
 */
 
+public class LDWTRESULT {
+    public int value;
+    // initalize ONE and ZERO in static OS.this();
+    public static LDWTRESULT ONE;
+    public static LDWTRESULT ZERO;
+    public this (int value) { this.value = value; }
+}
 
 
 public class OS : C {
@@ -194,6 +201,8 @@
 
     /* Get the Windows version and the flags */
     public static this() {
+        LDWTRESULT.ONE = new LDWTRESULT(1);
+        LDWTRESULT.ZERO = new LDWTRESULT(0);
         /*
         * Try the UNICODE version of GetVersionEx first
         * and then the ANSI version.  The UNICODE version
@@ -261,57 +270,57 @@
         //PORTING_CHANGE: made by version
         //IsUnicode = !IsWin32s && !IsWin95;
         /* Load the manifest to force the XP Theme */
-
-		ULONG_PTR ulpActivationCookie;
-		ACTCTX actctx;
-		HANDLE hActCtx = INVALID_HANDLE_VALUE;
-		DWORD dwLastError;
-		
-		tango.io.TempFile.TempFile.Style style = {tango.io.TempFile.TempFile.Transience.Transient};
-		
-		scope File file;
-		scope temp = new tango.io.TempFile.TempFile(style);
-		scope filePath = temp.path;
-		
-		const char[] filename = "dwt.manifest";
-		const char[] manifest = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-								<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
-									<assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="dwt" type="win32"/>
-									<description>D Widget Toolkit</description>
-									<dependency>
-										<dependentAssembly>
-											<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*"/>
-										</dependentAssembly>
-									</dependency>
-								</assembly>`;
-		
-		filePath.file = filename;
-		
-		if (!filePath.exists)
-		{
-			file = new File(filePath.toString);
-			file.write(manifest);
-		}
-		
-		memset(&actctx, 0, actctx.sizeof);
-		actctx.cbSize = actctx.sizeof;
-		actctx.lpSource = toString16(filePath.toString).toString16z();
-		
-		// Create the activation context, then delete the string - we don't need it
-		// anymore.
-		hActCtx = OS.CreateActCtx(&actctx);
-		
-		// Did we fail creating the activation context?
-		if (hActCtx == INVALID_HANDLE_VALUE)
-			Trace.formatln("The Activation Context could not be created");
-		
-		// Activate the context and make use of it
-		if (!OS.ActivateActCtx(hActCtx, &ulpActivationCookie))
-			Trace.formatln("The Activation Context failed to load");
+        if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (5, 1)) {
+
+            ULONG_PTR ulpActivationCookie;
+            ACTCTX actctx;
+            HANDLE hActCtx = INVALID_HANDLE_VALUE;
+            DWORD dwLastError;
+
+            tango.io.TempFile.TempFile.Style style = {tango.io.TempFile.TempFile.Transience.Transient};
+
+            scope File file;
+            scope temp = new tango.io.TempFile.TempFile(style);
+            scope filePath = temp.path;
+
+            const char[] filename = "dwt.manifest";
+            const char[] manifest = `<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+                                    <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+                                        <assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="dwt" type="win32"/>
+                                        <description>D Widget Toolkit</description>
+                                        <dependency>
+                                            <dependentAssembly>
+                                                <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*"/>
+                                            </dependentAssembly>
+                                        </dependency>
+                                    </assembly>`;
+
+            filePath.file = filename;
+
+            if (!filePath.exists)
+            {
+                file = new File(filePath.toString);
+                file.write(manifest);
+            }
+
+            memset(&actctx, 0, actctx.sizeof);
+            actctx.cbSize = actctx.sizeof;
+            actctx.lpSource = toString16(filePath.toString).toString16z();
+
+            // Create the activation context, then delete the string - we don't need it
+            // anymore.
+            hActCtx = OS.CreateActCtx(&actctx);
+
+            // Did we fail creating the activation context?
+            if (hActCtx == INVALID_HANDLE_VALUE)
+                Trace.formatln("The Activation Context could not be created");
+
+            // Activate the context and make use of it
+            if (!OS.ActivateActCtx(hActCtx, &ulpActivationCookie))
+                Trace.formatln("The Activation Context failed to load");
 
 
 /+         //if (System.getProperty (NO_MANIFEST) is null) {
-           if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (5, 1)) {
 trace(__LINE__);
                 TCHAR[] buffer = new TCHAR[ MAX_PATH ];
                 HANDLE hModule = OS.GetLibraryHandle ();
@@ -341,9 +350,9 @@
                 * for the entire lifetime of the program.  It is deactivated
                 * and released by Windows when the program exits.
                 */
-            }
         //}
 +/
+        }
         /* Make the process DPI aware for Windows Vista */
         if (OS.WIN32_VERSION >= OS.VERSION (6, 0)) OS.SetProcessDPIAware ();
 
--- a/dwt/widgets/Button.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/widgets/Button.d	Mon Feb 11 02:44:32 2008 +0100
@@ -358,9 +358,9 @@
     addListener (DWT.DefaultSelection,typedListener);
 }
 
-override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
-    if (handle is null) return LRESULT.ZERO;
-    return cast(LRESULT) OS.CallWindowProc ( ButtonProc, hwnd, msg, wParam, lParam);
+override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
+    if (handle is null) return 0;
+    return OS.CallWindowProc ( ButtonProc, hwnd, msg, wParam, lParam);
 }
 
 static int checkStyle (int style) {
@@ -1064,7 +1064,7 @@
 
 override LRESULT WM_ERASEBKGND (int wParam, int lParam) {
     LRESULT result = super.WM_ERASEBKGND (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Bug in Windows.  For some reason, the HBRUSH that
     * is returned from WM_CTRLCOLOR is misaligned when
@@ -1086,9 +1086,9 @@
 
 override LRESULT WM_GETDLGCODE (int wParam, int lParam) {
     LRESULT result = super.WM_GETDLGCODE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     if ((style & DWT.ARROW) !is 0) {
-        return cast( LRESULT )(OS.DLGC_STATIC);
+        return new LRESULT (OS.DLGC_STATIC);
     }
     return result;
 }
@@ -1102,12 +1102,12 @@
 }
 
 override LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
-    if (ignoreMouse) return LRESULT.NULL;
+    if (ignoreMouse) return null;
     return super.WM_LBUTTONDOWN (wParam, lParam);
 }
 
 override LRESULT WM_LBUTTONUP (int wParam, int lParam) {
-    if (ignoreMouse) return LRESULT.NULL;
+    if (ignoreMouse) return null;
     return super.WM_LBUTTONUP (wParam, lParam);
 }
 
@@ -1134,7 +1134,7 @@
 
 override LRESULT WM_SIZE (int wParam, int lParam) {
     LRESULT result = super.WM_SIZE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     if (OS.COMCTL32_MAJOR >= 6) {
         if ((style & (DWT.PUSH | DWT.TOGGLE)) !is 0) {
             if (imageList !is null && text.length !is 0) {
@@ -1152,14 +1152,14 @@
 
 override LRESULT WM_SYSCOLORCHANGE (int wParam, int lParam) {
     LRESULT result = super.WM_SYSCOLORCHANGE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     if (image2 !is null) _setImage (image);
     return result;
 }
 
 override LRESULT WM_UPDATEUISTATE (int wParam, int lParam) {
     LRESULT result = super.WM_UPDATEUISTATE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Feature in Windows.  When WM_UPDATEUISTATE is sent to
     * a button, it sends WM_CTLCOLORBTN to get the foreground
@@ -1185,7 +1185,7 @@
             if (redraw) {
                 OS.InvalidateRect (handle, null, false);
                 int code = OS.DefWindowProc (handle, OS.WM_UPDATEUISTATE, wParam, lParam);
-                return cast( LRESULT )(code);
+                return new LRESULT (code);
             }
         }
     }
@@ -1228,7 +1228,7 @@
         if ((style & (DWT.RADIO | DWT.CHECK)) !is 0) {
             if (findImageControl () !is null) {
                 OS.SetBkMode (cast(HANDLE)wParam, OS.TRANSPARENT);
-                return cast( LRESULT )(OS.GetStockObject (OS.NULL_BRUSH));
+                return new LRESULT ( cast(int) OS.GetStockObject (OS.NULL_BRUSH));
             }
         }
     }
@@ -1272,7 +1272,7 @@
         if ((struct_.itemState & OS.ODS_SELECTED) !is 0) uState |= OS.DFCS_PUSHED;
         OS.DrawFrameControl (struct_.hDC, &rect, OS.DFC_SCROLL, uState);
     }
-    return LRESULT.NULL;
+    return null;
 }
 
 }
--- a/dwt/widgets/Canvas.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/widgets/Canvas.d	Mon Feb 11 02:44:32 2008 +0100
@@ -369,7 +369,7 @@
 
 override LRESULT WM_WINDOWPOSCHANGED (int wParam, int lParam) {
     LRESULT result  = super.WM_WINDOWPOSCHANGED (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Bug in Windows.  When a window with style WS_EX_LAYOUTRTL
     * that contains a caret is resized, Windows does not move the
@@ -384,7 +384,7 @@
 
 override LRESULT WM_WINDOWPOSCHANGING (int wParam, int lParam) {
     LRESULT result  = super.WM_WINDOWPOSCHANGING (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Bug in Windows.  When a window with style WS_EX_LAYOUTRTL
     * that contains a caret is resized, Windows does not move the
--- a/dwt/widgets/Combo.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/widgets/Combo.d	Mon Feb 11 02:44:32 2008 +0100
@@ -318,20 +318,20 @@
     addListener (DWT.Verify, typedListener);
 }
 
-override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
-    if (handle is null) return LRESULT.ZERO;
+override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
+    if (handle is null) return 0;
     if (hwnd is handle) {
-        return cast(LRESULT) OS.CallWindowProc( ComboProc, hwnd, msg, wParam, lParam);
+        return OS.CallWindowProc( ComboProc, hwnd, msg, wParam, lParam);
     }
     auto hwndText = OS.GetDlgItem (handle, CBID_EDIT);
     if (hwnd is hwndText) {
-        return cast(LRESULT) OS.CallWindowProc( EditProc, hwnd, msg, wParam, lParam);
+        return OS.CallWindowProc( EditProc, hwnd, msg, wParam, lParam);
     }
     auto hwndList = OS.GetDlgItem (handle, CBID_LIST);
     if (hwnd is hwndList) {
-        return cast(LRESULT) OS.CallWindowProc( ListProc, hwnd, msg, wParam, lParam);
+        return OS.CallWindowProc( ListProc, hwnd, msg, wParam, lParam);
     }
-    return cast(LRESULT) OS.DefWindowProc (hwnd, msg, wParam, lParam);
+    return OS.DefWindowProc (hwnd, msg, wParam, lParam);
 }
 
 private static extern(Windows) int CBTFunc (int nCode, int wParam, int lParam) {
@@ -2020,7 +2020,7 @@
         auto hwndText = OS.GetDlgItem (handle, CBID_EDIT);
         auto hwndList = OS.GetDlgItem (handle, CBID_LIST);
         if ((hwndText !is null && hwnd is hwndText) || (hwndList !is null && hwnd is hwndList)) {
-            LRESULT result = LRESULT.NULL;
+            LRESULT result = null;
             switch (msg) {
                 /* Keyboard messages */
                 case OS.WM_CHAR:        result = wmChar (hwnd, wParam, lParam); break;
@@ -2069,7 +2069,7 @@
                     break;
                 default:
             }
-            if (result !is LRESULT.NULL) return result;
+            if (result !is null) return result.value;
             return callWindowProc (hwnd, msg, wParam, lParam);
         }
     }
@@ -2108,7 +2108,7 @@
 
 override LRESULT WM_GETDLGCODE (int wParam, int lParam) {
     int code = callWindowProc (handle, OS.WM_GETDLGCODE, wParam, lParam);
-    return cast( LRESULT )(code | OS.DLGC_WANTARROWS);
+    return new LRESULT (code | OS.DLGC_WANTARROWS);
 }
 
 override LRESULT WM_KILLFOCUS (int wParam, int lParam) {
@@ -2128,7 +2128,7 @@
     * Return NULL - Focus notification is
     * done in WM_COMMAND by CBN_KILLFOCUS.
     */
-    return LRESULT.NULL;
+    return null;
 }
 
 override LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
@@ -2159,7 +2159,7 @@
     * Return NULL - Focus notification is
     * done by WM_COMMAND with CBN_SETFOCUS.
     */
-    return LRESULT.NULL;
+    return null;
 }
 
 override LRESULT WM_SIZE (int wParam, int lParam) {
@@ -2192,7 +2192,7 @@
     * match from the list.  The fix is to remember the original
     * text and reset it after the widget is resized.
     */
-    LRESULT result = LRESULT.NULL;
+    LRESULT result = null;
     if ((style & DWT.READ_ONLY) !is 0) {
         result = super.WM_SIZE (wParam, lParam);
     } else {
@@ -2237,9 +2237,9 @@
 }
 
 override LRESULT wmChar (HWND hwnd, int wParam, int lParam) {
-    if (ignoreCharacter) return LRESULT.NULL;
+    if (ignoreCharacter) return null;
     LRESULT result = super.wmChar (hwnd, wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Feature in Windows.  For some reason, when the
     * widget is a single line text widget, when the
@@ -2268,8 +2268,8 @@
 }
 
 LRESULT wmClipboard (HWND hwndText, int msg, int wParam, int lParam) {
-    if ((style & DWT.READ_ONLY) !is 0) return LRESULT.NULL;
-    if (!hooks (DWT.Verify) && !filters (DWT.Verify)) return LRESULT.NULL;
+    if ((style & DWT.READ_ONLY) !is 0) return null;
+    if (!hooks (DWT.Verify) && !filters (DWT.Verify)) return null;
     bool call = false;
     int start, end;
     char[] newText = null;
@@ -2333,7 +2333,7 @@
                 OS.MoveMemory (pszText, buffer.ptr, byteCount);
                 int code = OS.CallWindowProc (EditProc, hwndText, msg, wParam, cast(int) pszText);
                 OS.HeapFree (hHeap, 0, pszText);
-                return cast( LRESULT )(code);
+                return new LRESULT (code);
             } else {
                 TCHAR* buffer = StrToTCHARz( newText );
                 OS.SendMessage (hwndText, OS.EM_REPLACESEL, 0, buffer);
@@ -2341,7 +2341,7 @@
             }
         }
     }
-    return LRESULT.NULL;
+    return null;
 }
 
 override LRESULT wmCommandChild (int wParam, int lParam) {
@@ -2441,13 +2441,13 @@
     sendKeyEvent (DWT.KeyUp, OS.WM_IME_CHAR, wParam, lParam);
     // widget could be disposed at this point
     display.lastKey = display.lastAscii = 0;
-    return cast( LRESULT )(result);
+    return new LRESULT (result);
 }
 
 override LRESULT wmKeyDown (HWND hwnd, int wParam, int lParam) {
-    if (ignoreCharacter) return LRESULT.NULL;
+    if (ignoreCharacter) return null;
     LRESULT result = super.wmKeyDown (hwnd, wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     ignoreDefaultSelection = false;
     if (wParam is OS.VK_RETURN) {
         if ((style & DWT.DROP_DOWN) !is 0) {
@@ -2469,7 +2469,7 @@
     */
     int oldSelection = OS.SendMessage (handle, OS.CB_GETCURSEL, 0, 0);
     LRESULT result = super.wmSysKeyDown (hwnd, wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     if ((style & DWT.READ_ONLY) is 0) {
         if (wParam is OS.VK_DOWN) {
             int code = callWindowProc (hwnd, OS.WM_SYSKEYDOWN, wParam, lParam);
@@ -2480,7 +2480,7 @@
                 sendEvent (DWT.Selection);
                 if (isDisposed ()) return LRESULT.ZERO;
             }
-            return cast( LRESULT )(code);
+            return new LRESULT (code);
         }
     }
     return result;
--- a/dwt/widgets/Composite.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/widgets/Composite.d	Mon Feb 11 02:44:32 2008 +0100
@@ -1065,7 +1065,7 @@
 
 override LRESULT WM_ERASEBKGND (int wParam, int lParam) {
     LRESULT result = super.WM_ERASEBKGND (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     if ((state & CANVAS) !is 0) {
         /* Return zero to indicate that the background was not erased */
         if ((style & DWT.NO_BACKGROUND) !is 0) return LRESULT.ZERO;
@@ -1075,7 +1075,7 @@
 
 override LRESULT WM_GETDLGCODE (int wParam, int lParam) {
     LRESULT result = super.WM_GETDLGCODE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     if ((state & CANVAS) !is 0) {
         int flags = 0;
         if (hooksKeys ()) {
@@ -1083,18 +1083,18 @@
         }
         if ((style & DWT.NO_FOCUS) !is 0) flags |= OS.DLGC_STATIC;
         if (OS.GetWindow (handle, OS.GW_CHILD) !is null) flags |= OS.DLGC_STATIC;
-        if (flags !is 0) return cast(LRESULT)flags;
+        if (flags !is 0) return new LRESULT (flags);
     }
     return result;
 }
 
 override LRESULT WM_GETFONT (int wParam, int lParam) {
     LRESULT result = super.WM_GETFONT (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     int code = callWindowProc (handle, OS.WM_GETFONT, wParam, lParam);
-    if (code !is 0) return cast( LRESULT )(code);
+    if (code !is 0) return new LRESULT (code);
     if (font is null) font = defaultFont ();
-    return cast( LRESULT )(font);
+    return new LRESULT (cast(int) font);
 }
 
 override LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
@@ -1112,7 +1112,7 @@
 
 override LRESULT WM_NCPAINT (int wParam, int lParam) {
     LRESULT result = super.WM_NCPAINT (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     if ((state & CANVAS) !is 0) {
         result = wmNCPaint (handle, wParam, lParam);
     }
@@ -1335,7 +1335,7 @@
 
 override LRESULT WM_PRINTCLIENT (int wParam, int lParam) {
     LRESULT result = super.WM_PRINTCLIENT (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     if ((state & CANVAS) !is 0) {
         forceResize ();
         auto nSavedDC = OS.SaveDC (cast(HDC)wParam);
@@ -1421,7 +1421,7 @@
 
 override LRESULT WM_SYSCOLORCHANGE (int wParam, int lParam) {
     LRESULT result = super.WM_SYSCOLORCHANGE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     auto hwndChild = OS.GetWindow (handle, OS.GW_CHILD);
     while (hwndChild !is null) {
         OS.SendMessage (hwndChild, OS.WM_SYSCOLORCHANGE, 0, 0);
@@ -1432,7 +1432,7 @@
 
 override LRESULT WM_SYSCOMMAND (int wParam, int lParam) {
     LRESULT result = super.WM_SYSCOMMAND (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
 
     /*
     * Check to see if the command is a system command or
@@ -1461,7 +1461,7 @@
                         OS.RedrawWindow (handle, null, null, flags);
                     }
                 if (code is 0) return LRESULT.ZERO;
-                return cast( LRESULT )(code);
+                return new LRESULT (code);
             default:
         }
     }
@@ -1471,7 +1471,7 @@
 
 override LRESULT WM_UPDATEUISTATE (int wParam, int lParam) {
     LRESULT result = super.WM_UPDATEUISTATE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     if ((state & CANVAS) !is 0) OS.InvalidateRect (handle, null, false);
     return result;
 }
@@ -1495,10 +1495,10 @@
             OS.ExcludeClipRect (hDC, border, border, rect.right - border, rect.bottom - border);
             OS.DrawThemeBackground (display.hEditTheme (), hDC, OS.EP_EDITTEXT, OS.ETS_NORMAL, &rect, null);
             OS.ReleaseDC (hwnd, hDC);
-            return cast(LRESULT )(code);
+            return new LRESULT (code);
         }
     }
-    return LRESULT.NULL;
+    return null;
 }
 
 override LRESULT wmNotify (NMHDR* hdr, int wParam, int lParam) {
--- a/dwt/widgets/Control.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/widgets/Control.d	Mon Feb 11 02:44:32 2008 +0100
@@ -3714,7 +3714,7 @@
 abstract int windowProc ();
 
 int windowProc (HWND hwnd, int msg, int wParam, int lParam) {
-    LRESULT result = LRESULT.NULL;
+    LRESULT result = null;
     switch (msg) {
         case OS.WM_ACTIVATE:            result = WM_ACTIVATE (wParam, lParam); break;
         case OS.WM_CAPTURECHANGED:      result = WM_CAPTURECHANGED (wParam, lParam); break;
@@ -3806,12 +3806,12 @@
         case OS.WM_XBUTTONUP:           result = WM_XBUTTONUP (wParam, lParam); break;
         default:
     }
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result.value;
     return callWindowProc (hwnd, msg, wParam, lParam);
 }
 
 LRESULT WM_ACTIVATE (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_CAPTURECHANGED (int wParam, int lParam) {
@@ -3823,11 +3823,11 @@
 }
 
 LRESULT WM_CLEAR (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_CLOSE (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_COMMAND (int wParam, int lParam) {
@@ -3844,10 +3844,10 @@
                 return item.wmCommandChild (wParam, lParam);
             }
         }
-        return LRESULT.NULL;
+        return null;
     }
     Control control = display.getControl (cast(HANDLE)lParam);
-    if (control is null) return LRESULT.NULL;
+    if (control is null) return null;
     return control.wmCommandChild (wParam, lParam);
 }
 
@@ -3862,36 +3862,36 @@
         OS.RealizePalette (cast(HPALETTE)wParam);
     }
     Control control = display.getControl (cast(HANDLE)lParam);
-    if (control is null) return LRESULT.NULL;
+    if (control is null) return null;
     return control.wmColorChild (wParam, lParam);
 }
 
 LRESULT WM_CUT (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_DESTROY (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_DRAWITEM (int wParam, int lParam) {
     DRAWITEMSTRUCT* struct_ = cast(DRAWITEMSTRUCT*)lParam;
     if (struct_.CtlType is OS.ODT_MENU) {
         MenuItem item = display.getMenuItem (struct_.itemID);
-        if (item is null) return LRESULT.NULL;
+        if (item is null) return null;
         return item.wmDrawChild (wParam, lParam);
     }
     Control control = display.getControl (struct_.hwndItem);
-    if (control is null) return LRESULT.NULL;
+    if (control is null) return null;
     return control.wmDrawChild (wParam, lParam);
 }
 
 LRESULT WM_ENDSESSION (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_ENTERIDLE (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_ERASEBKGND (int wParam, int lParam) {
@@ -3903,38 +3903,38 @@
             if (findThemeControl () !is null) return LRESULT.ONE;
         }
     }
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_GETDLGCODE (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_GETFONT (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_GETOBJECT (int wParam, int lParam) {
     if (accessible !is null) {
-        LRESULT result = cast(LRESULT) accessible.internal_WM_GETOBJECT (wParam, lParam);
-        if (result !is 0) return result;
+        int result = accessible.internal_WM_GETOBJECT (wParam, lParam);
+        if (result !is 0) return new LRESULT (result);
     }
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_GETMINMAXINFO (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_HOTKEY (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_HELP (int wParam, int lParam) {
-    if (OS.IsWinCE) return LRESULT.NULL;
+    if (OS.IsWinCE) return null;
     HELPINFO* lphi = cast(HELPINFO*)lParam;
     Decorations shell = menuShell ();
-    if (!shell.isEnabled ()) return LRESULT.NULL;
+    if (!shell.isEnabled ()) return null;
     if (lphi.iContextType is OS.HELPINFO_MENUITEM) {
         MenuItem item = display.getMenuItem (lphi.iCtrlId);
         if (item !is null && item.isEnabled ()) {
@@ -3952,18 +3952,18 @@
                 return LRESULT.ONE;
             }
         }
-        return LRESULT.NULL;
+        return null;
     }
     if (hooks (DWT.Help)) {
         postEvent (DWT.Help);
         return LRESULT.ONE;
     }
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_HSCROLL (int wParam, int lParam) {
     Control control = display.getControl (cast(HANDLE)lParam);
-    if (control is null) return LRESULT.NULL;
+    if (control is null) return null;
     return control.wmScrollChild (wParam, lParam);
 }
 
@@ -3972,13 +3972,13 @@
 }
 
 LRESULT WM_IME_COMPOSITION (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_INITMENUPOPUP (int wParam, int lParam) {
 
     /* Ignore WM_INITMENUPOPUP for an accelerator */
-    if (display.accelKeyHit) return LRESULT.NULL;
+    if (display.accelKeyHit) return null;
 
     /*
     * If the high order word of LPARAM is non-zero,
@@ -4029,11 +4029,11 @@
         newMenu.sendEvent (DWT.Show);
         // widget could be disposed at this point
     }
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_INPUTLANGCHANGE (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_KEYDOWN (int wParam, int lParam) {
@@ -4076,12 +4076,12 @@
     MEASUREITEMSTRUCT* struct_ = cast(MEASUREITEMSTRUCT*)lParam;;
     if (struct_.CtlType is OS.ODT_MENU) {
         MenuItem item = display.getMenuItem (struct_.itemID);
-        if (item is null) return LRESULT.NULL;
+        if (item is null) return null;
         return item.wmMeasureChild (wParam, lParam);
     }
     auto hwnd = OS.GetDlgItem (handle, struct_.CtlID);
     Control control = display.getControl (hwnd);
-    if (control is null) return LRESULT.NULL;
+    if (control is null) return null;
     return control.wmMeasureChild (wParam, lParam);
 }
 
@@ -4097,9 +4097,9 @@
     int type = wParam >> 16;
     if (type is 0 || type is OS.MF_SYSMENU) {
         display.mnemonicKeyHit = false;
-        return cast( LRESULT )(OS.MNC_CLOSE << 16);
+        return new LRESULT (OS.MNC_CLOSE << 16);
     }
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_MENUSELECT (int wParam, int lParam) {
@@ -4135,9 +4135,9 @@
         * to null in a destroyed widget is not harmful.
         */
         shell.activeMenu = null;
-        return LRESULT.NULL;
+        return null;
     }
-    if ((code & OS.MF_SYSMENU) !is 0) return LRESULT.NULL;
+    if ((code & OS.MF_SYSMENU) !is 0) return null;
     if ((code & OS.MF_HILITE) !is 0) {
         MenuItem item = null;
         Decorations menuShell = menuShell ();
@@ -4194,11 +4194,11 @@
         }
         if (item !is null) item.sendEvent (DWT.Arm);
     }
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_MOUSEACTIVATE (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_MOUSEHOVER (int wParam, int lParam) {
@@ -4232,29 +4232,29 @@
     }
     sendEvent (DWT.Move);
     // widget could be disposed at this point
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_NCACTIVATE (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_NCCALCSIZE (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_NCHITTEST (int wParam, int lParam) {
-    if (!OS.IsWindowEnabled (handle)) return LRESULT.NULL;
-    if (!isActive ()) return cast( LRESULT )(OS.HTTRANSPARENT);
-    return LRESULT.NULL;
+    if (!OS.IsWindowEnabled (handle)) return null;
+    if (!isActive ()) return new LRESULT (OS.HTTRANSPARENT);
+    return null;
 }
 
 LRESULT WM_NCLBUTTONDOWN (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_NCPAINT (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_NOTIFY (int wParam, int lParam) {
@@ -4267,15 +4267,15 @@
 }
 
 LRESULT WM_PALETTECHANGED (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_PARENTNOTIFY (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_PASTE (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_PRINT (int wParam, int lParam) {
@@ -4283,19 +4283,19 @@
 }
 
 LRESULT WM_PRINTCLIENT (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_QUERYENDSESSION (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_QUERYNEWPALETTE (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_QUERYOPEN (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_RBUTTONDBLCLK (int wParam, int lParam) {
@@ -4314,14 +4314,14 @@
     int hitTest = cast(short) (lParam & 0xFFFF);
     if (hitTest is OS.HTCLIENT) {
         Control control = display.getControl (cast(HANDLE)wParam);
-        if (control is null) return LRESULT.NULL;
+        if (control is null) return null;
         Cursor cursor = control.findCursor ();
         if (cursor !is null) {
             OS.SetCursor (cursor.handle);
             return LRESULT.ONE;
         }
     }
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_SETFOCUS (int wParam, int lParam) {
@@ -4329,25 +4329,25 @@
 }
 
 LRESULT WM_SETTINGCHANGE (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_SETFONT (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_SETREDRAW (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_SHOWWINDOW (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_SIZE (int wParam, int lParam) {
     sendEvent (DWT.Resize);
     // widget could be disposed at this point
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_SYSCHAR (int wParam, int lParam) {
@@ -4355,7 +4355,7 @@
 }
 
 LRESULT WM_SYSCOLORCHANGE (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_SYSCOMMAND (int wParam, int lParam) {
@@ -4469,7 +4469,7 @@
             break;
         default:
     }
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_SYSKEYDOWN (int wParam, int lParam) {
@@ -4481,25 +4481,25 @@
 }
 
 LRESULT WM_TIMER (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_UNDO (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_UPDATEUISTATE (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_VSCROLL (int wParam, int lParam) {
     Control control = display.getControl (cast(HANDLE)lParam);
-    if (control is null) return LRESULT.NULL;
+    if (control is null) return null;
     return control.wmScrollChild (wParam, lParam);
 }
 
 LRESULT WM_WINDOWPOSCHANGED (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_WINDOWPOSCHANGING (int wParam, int lParam) {
@@ -4522,7 +4522,7 @@
             }
         }
     }
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT WM_XBUTTONDBLCLK (int wParam, int lParam) {
@@ -4550,11 +4550,11 @@
                     OS.SetBkColor (cast(HANDLE)wParam, getBackgroundPixel ());
                     fillThemeBackground (cast(HANDLE)wParam, control, &rect);
                     OS.SetBkMode (cast(HANDLE)wParam, OS.TRANSPARENT);
-                    return cast( LRESULT )(OS.GetStockObject (OS.NULL_BRUSH));
+                    return new LRESULT ( cast(int) OS.GetStockObject (OS.NULL_BRUSH));
                 }
             }
         }
-        if (foreground is -1) return LRESULT.NULL;
+        if (foreground is -1) return null;
     }
     if (control is null) control = this;
     int forePixel = getForegroundPixel ();
@@ -4578,7 +4578,7 @@
             OS.SelectObject (cast(HANDLE)wParam, hOldBrush);
         }
         OS.SetBkMode (cast(HANDLE)wParam, OS.TRANSPARENT);
-        return cast( LRESULT )(hBrush);
+        return new LRESULT ( cast(int) hBrush);
     }
     auto hBrush = findBrush (backPixel, OS.BS_SOLID);
     if ((state & DRAW_BACKGROUND) !is 0) {
@@ -4588,33 +4588,33 @@
         OS.PatBlt (cast(HANDLE)wParam, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top, OS.PATCOPY);
         OS.SelectObject (cast(HANDLE)wParam, hOldBrush);
     }
-    return cast( LRESULT )(hBrush);
+    return new LRESULT ( cast(int) hBrush);
 }
 
 LRESULT wmCommandChild (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT wmDrawChild (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT wmMeasureChild (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT wmNotify (NMHDR* hdr, int wParam, int lParam) {
     Control control = display.getControl (hdr.hwndFrom);
-    if (control is null) return LRESULT.NULL;
+    if (control is null) return null;
     return control.wmNotifyChild (hdr, wParam, lParam);
 }
 
 LRESULT wmNotifyChild (NMHDR* hdr, int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT wmScrollChild (int wParam, int lParam) {
-    return LRESULT.NULL;
-}
-
-}
+    return null;
+}
+
+}
--- a/dwt/widgets/CoolBar.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/widgets/CoolBar.d	Mon Feb 11 02:44:32 2008 +0100
@@ -140,9 +140,9 @@
     }
 }
 
-override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
-    if (handle is null) return LRESULT.NULL;
-    return cast(LRESULT) OS.CallWindowProc (ReBarProc, hwnd, msg, wParam, lParam);
+override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
+    if (handle is null) return 0;
+    return OS.CallWindowProc (ReBarProc, hwnd, msg, wParam, lParam);
 }
 
 static int checkStyle (int style) {
@@ -1028,7 +1028,7 @@
     * for this control.
     */
     LRESULT result = super.WM_COMMAND (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     return LRESULT.ZERO;
 }
 
@@ -1049,7 +1049,7 @@
     */
     if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) {
         drawBackground ( cast(HDC) wParam);
-        return LRESULT.NULL;
+        return null;
     }
     return result;
 }
@@ -1074,13 +1074,13 @@
     * for this control.
     */
     LRESULT result = super.WM_NOTIFY (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     return LRESULT.ZERO;
 }
 
 override LRESULT WM_SETREDRAW (int wParam, int lParam) {
     LRESULT result = super.WM_SETREDRAW (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Feature in Windows.  When redraw is turned off, the rebar
     * control does not call the default window proc.  This means
@@ -1107,14 +1107,14 @@
     if ( rect != getBounds ()) {
         parent.redraw (rect.x, rect.y, rect.width, rect.height, true);
     }
-    return cast( LRESULT )(code);
+    return new LRESULT (code);
 }
 
 override LRESULT WM_SIZE (int wParam, int lParam) {
     if (ignoreResize) {
         int code = callWindowProc (handle, OS.WM_SIZE, wParam, lParam);
         if (code is 0) return LRESULT.ZERO;
-        return cast( LRESULT )(code);
+        return new LRESULT (code);
     }
     //TEMPORARY CODE
 //  if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
@@ -1204,7 +1204,7 @@
                 //OS.MoveMemory (nmcd, lParam, NMCUSTOMDRAW.sizeof);
                 switch (nmcd.dwDrawStage) {
                     case OS.CDDS_PREERASE:
-                        return cast(LRESULT) (OS.CDRF_SKIPDEFAULT | OS.CDRF_NOTIFYPOSTERASE);
+                        return new LRESULT (OS.CDRF_SKIPDEFAULT | OS.CDRF_NOTIFYPOSTERASE);
                     case OS.CDDS_POSTERASE:
                         drawBackground (nmcd.hdc);
                         break;
--- a/dwt/widgets/Decorations.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/widgets/Decorations.d	Mon Feb 11 02:44:32 2008 +0100
@@ -318,9 +318,9 @@
     if (!isValidSubclass ()) error (DWT.ERROR_INVALID_SUBCLASS);
 }
 
-override override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
-    if (handle is null) return LRESULT.ZERO;
-    return cast(LRESULT) OS.DefMDIChildProc (hwnd, msg, wParam, lParam);
+override override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
+    if (handle is null) return 0;
+    return OS.DefMDIChildProc (hwnd, msg, wParam, lParam);
 }
 
 void closeWidget () {
@@ -1621,7 +1621,7 @@
 
 override LRESULT WM_ACTIVATE (int wParam, int lParam) {
     LRESULT result = super.WM_ACTIVATE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Feature in AWT.  When an AWT Window is activated,
     * for some reason, it seems to forward the WM_ACTIVATE
@@ -1682,14 +1682,14 @@
 
 override LRESULT WM_CLOSE (int wParam, int lParam) {
     LRESULT result = super.WM_CLOSE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     if (isEnabled () && isActive ()) closeWidget ();
     return LRESULT.ZERO;
 }
 
 override LRESULT WM_HOTKEY (int wParam, int lParam) {
     LRESULT result = super.WM_HOTKEY (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     static if( OS.IsWinCE ){
         if (OS.IsSP) {
             /*
@@ -1725,7 +1725,7 @@
     if (moved) {
         Point location = getLocation ();
         if (location.x is oldX && location.y is oldY) {
-            return LRESULT.NULL;
+            return null;
         }
         oldX = location.x;
         oldY = location.y;
@@ -1735,7 +1735,7 @@
 
 override LRESULT WM_NCACTIVATE (int wParam, int lParam) {
     LRESULT result = super.WM_NCACTIVATE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     if (wParam is 0) {
         if (display.lockActiveWindow) return LRESULT.ZERO;
         Control control = display.findControl (cast(HANDLE)lParam);
@@ -1761,7 +1761,7 @@
 
 override LRESULT WM_QUERYOPEN (int wParam, int lParam) {
     LRESULT result = super.WM_QUERYOPEN (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     sendEvent (DWT.Deiconify);
     // widget could be disposed at this point
     return result;
@@ -1774,7 +1774,7 @@
 }
 
 override LRESULT WM_SIZE (int wParam, int lParam) {
-    LRESULT result = LRESULT.NULL;
+    LRESULT result = null;
     bool changed = true;
     if (resized) {
         int newWidth = 0, newHeight = 0;
@@ -1810,7 +1810,7 @@
 
 override LRESULT WM_SYSCOMMAND (int wParam, int lParam) {
     LRESULT result = super.WM_SYSCOMMAND (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     if (!(cast(Shell)this)) {
         int cmd = wParam & 0xFFF0;
         switch (cmd) {
@@ -1830,7 +1830,7 @@
 
 override LRESULT WM_WINDOWPOSCHANGING (int wParam, int lParam) {
     LRESULT result = super.WM_WINDOWPOSCHANGING (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     if (display.lockActiveWindow) {
         WINDOWPOS* lpwp = cast(WINDOWPOS*)lParam;
         //OS.MoveMemory (lpwp, lParam, WINDOWPOS.sizeof);
--- a/dwt/widgets/ExpandBar.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/widgets/ExpandBar.d	Mon Feb 11 02:44:32 2008 +0100
@@ -35,6 +35,10 @@
 import dwt.widgets.Event;
 
 import dwt.dwthelper.utils;
+import tango.util.log.Trace;
+void trc( long line ){
+    //Trace.formatln( "ExpandBar {}", line );
+}
 
 /**
  * Instances of this class support the layout of selectable
@@ -131,8 +135,8 @@
     addListener (DWT.Collapse, typedListener);
 }
 
-override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
-    if (handle is null) return LRESULT.ZERO;
+override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
+    if (handle is null) return 0;
     return cast(LRESULT) OS.DefWindowProc (hwnd, msg, wParam, lParam);
 }
 
@@ -585,8 +589,9 @@
 }
 
 override LRESULT WM_KEYDOWN (int wParam, int lParam) {
+trc(__LINE__);
     LRESULT result = super.WM_KEYDOWN (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     if (focusItem is null) return result;
     switch (wParam) {
         case OS.VK_SPACE:
@@ -623,12 +628,14 @@
 }
 
 override LRESULT WM_KILLFOCUS (int wParam, int lParam) {
+trc(__LINE__);
     LRESULT result = super.WM_KILLFOCUS (wParam, lParam);
     if (focusItem !is null) focusItem.redraw (true);
     return result;
 }
 
 override LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
+//trc(__LINE__);
     LRESULT result = super.WM_LBUTTONDOWN (wParam, lParam);
     if (result is LRESULT.ZERO) return result;
     int x = cast(short) (lParam & 0xFFFF);
@@ -665,8 +672,9 @@
 }
 
 override LRESULT WM_MOUSELEAVE (int wParam, int lParam) {
+trc(__LINE__);
     LRESULT result = super.WM_MOUSELEAVE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     for (int i = 0; i < itemCount; i++) {
         ExpandItem item = items [i];
         if (item.hover) {
@@ -679,6 +687,7 @@
 }
 
 override LRESULT WM_MOUSEMOVE (int wParam, int lParam) {
+trc(__LINE__);
     LRESULT result = super.WM_MOUSEMOVE (wParam, lParam);
     if (result is LRESULT.ZERO) return result;
     int x = cast(short) (lParam & 0xFFFF);
@@ -695,6 +704,7 @@
 }
 
 override LRESULT WM_PAINT (int wParam, int lParam) {
+trc(__LINE__);
     PAINTSTRUCT ps;
     GCData data = new GCData ();
     data.ps = &ps;
@@ -724,6 +734,7 @@
 }
 
 override LRESULT WM_PRINTCLIENT (int wParam, int lParam) {
+trc(__LINE__);
     LRESULT result = super.WM_PRINTCLIENT (wParam, lParam);
     RECT rect;
     OS.GetClientRect (handle, &rect);
@@ -737,8 +748,9 @@
 }
 
 override LRESULT WM_SETCURSOR (int wParam, int lParam) {
+trc(__LINE__);
     LRESULT result = super.WM_SETCURSOR (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     int hitTest = lParam & 0xFFFF;
     if (hitTest is OS.HTCLIENT) {
         for (int i = 0; i < itemCount; i++) {
@@ -754,12 +766,14 @@
 }
 
 override LRESULT WM_SETFOCUS (int wParam, int lParam) {
+trc(__LINE__);
     LRESULT result = super.WM_SETFOCUS (wParam, lParam);
     if (focusItem !is null) focusItem.redraw (true);
     return result;
 }
 
 override LRESULT WM_SIZE (int wParam, int lParam) {
+trc(__LINE__);
     LRESULT result = super.WM_SIZE (wParam, lParam);
     RECT rect;
     OS.GetClientRect (handle, &rect);
@@ -774,6 +788,7 @@
 }
 
 override LRESULT wmScroll (ScrollBar bar, bool update, HWND hwnd, int msg, int wParam, int lParam) {
+trc(__LINE__);
     LRESULT result = super.wmScroll (bar, true, hwnd, msg, wParam, lParam);
     SCROLLINFO info;
     info.cbSize = SCROLLINFO.sizeof;
--- a/dwt/widgets/Group.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/widgets/Group.d	Mon Feb 11 02:44:32 2008 +0100
@@ -143,8 +143,8 @@
     super (parent, checkStyle (style));
 }
 
-override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
-    if (handle is null) return LRESULT.NULL;
+override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
+    if (handle is null) return 0;
     /*
     * Feature in Windows.  When the user clicks on the group
     * box label, the group box takes focus.  This is unwanted.
@@ -153,10 +153,10 @@
     switch (msg) {
         case OS.WM_LBUTTONDOWN:
         case OS.WM_LBUTTONDBLCLK:
-            return cast(LRESULT) OS.DefWindowProc (hwnd, msg, wParam, lParam);
+            return OS.DefWindowProc (hwnd, msg, wParam, lParam);
         default:
     }
-    return cast(LRESULT) OS.CallWindowProc (GroupProc, hwnd, msg, wParam, lParam);
+    return OS.CallWindowProc (GroupProc, hwnd, msg, wParam, lParam);
 }
 
 static int checkStyle (int style) {
@@ -384,7 +384,7 @@
 
 override LRESULT WM_ERASEBKGND (int wParam, int lParam) {
     LRESULT result = super.WM_ERASEBKGND (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Feature in Windows.  Group boxes do not erase
     * the background before drawing.  The fix is to
@@ -396,7 +396,7 @@
 
 override LRESULT WM_NCHITTEST (int wParam, int lParam) {
     LRESULT result = super.WM_NCHITTEST (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Feature in Windows.  The window proc for the group box
     * returns HTTRANSPARENT indicating that mouse messages
@@ -408,12 +408,12 @@
     */
     int code = callWindowProc (handle, OS.WM_NCHITTEST, wParam, lParam);
     if (code is OS.HTTRANSPARENT) code = OS.HTCLIENT;
-    return cast(LRESULT) (code);
+    return new LRESULT (code);
 }
 
 override LRESULT WM_MOUSEMOVE (int wParam, int lParam) {
     LRESULT result = super.WM_MOUSEMOVE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Feature in Windows.  In version 6.00 of COMCTL32.DLL,
     * every time the mouse moves, the group title redraws.
@@ -425,7 +425,7 @@
 
 override LRESULT WM_PRINTCLIENT (int wParam, int lParam) {
     LRESULT result = super.WM_PRINTCLIENT (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Feature in Windows.  In version 6.00 of COMCTL32.DLL,
     * when WM_PRINTCLIENT is sent from a child BS_GROUP
@@ -440,14 +440,14 @@
         auto nSavedDC = OS.SaveDC (cast(HDC)wParam);
         int code = callWindowProc (handle, OS.WM_PRINTCLIENT, wParam, lParam);
         OS.RestoreDC (cast(HDC)wParam, nSavedDC);
-        return cast(LRESULT) (code);
+        return new LRESULT (code);
     }
     return result;
 }
 
 override LRESULT WM_UPDATEUISTATE (int wParam, int lParam) {
     LRESULT result = super.WM_UPDATEUISTATE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Feature in Windows.  When WM_UPDATEUISTATE is sent to
     * a group, it sends WM_CTLCOLORBTN to get the foreground
@@ -468,14 +468,14 @@
     if (redraw) {
         OS.InvalidateRect (handle, null, false);
         int code = OS.DefWindowProc (handle, OS.WM_UPDATEUISTATE, wParam, lParam);
-        return cast(LRESULT) (code);
+        return new LRESULT (code);
     }
     return result;
 }
 
 override LRESULT WM_WINDOWPOSCHANGING (int wParam, int lParam) {
     LRESULT result = super.WM_WINDOWPOSCHANGING (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Invalidate the portion of the group widget that needs to
     * be redrawn.  Note that for some reason, invalidating the
--- a/dwt/widgets/Label.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/widgets/Label.d	Mon Feb 11 02:44:32 2008 +0100
@@ -122,9 +122,9 @@
     super (parent, checkStyle (style));
 }
 
-override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
-    if (handle is null) return LRESULT.NULL;
-    return cast(LRESULT) OS.CallWindowProc (LabelProc, hwnd, msg, wParam, lParam);
+override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
+    if (handle is null) return 0;
+    return OS.CallWindowProc (LabelProc, hwnd, msg, wParam, lParam);
 }
 
 static int checkStyle (int style) {
@@ -462,7 +462,7 @@
 
 override LRESULT WM_ERASEBKGND (int wParam, int lParam) {
     LRESULT result = super.WM_ERASEBKGND (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
     if ((bits & OS.SS_OWNERDRAW) is OS.SS_OWNERDRAW) {
         return LRESULT.ONE;
@@ -531,7 +531,7 @@
     if (redraw) {
         OS.InvalidateRect (handle, null, false);
         int code = OS.DefWindowProc (handle, OS.WM_UPDATEUISTATE, wParam, lParam);
-        return cast(LRESULT) (code);
+        return new LRESULT (code);
     }
     return result;
 }
@@ -551,7 +551,7 @@
         if ((bits & OS.SS_OWNERDRAW) !is OS.SS_OWNERDRAW) {
             if (findImageControl () !is null) {
                 OS.SetBkMode ( cast(HANDLE) wParam, OS.TRANSPARENT);
-                return cast(LRESULT) (OS.GetStockObject (OS.NULL_BRUSH));
+                return new LRESULT ( cast(int)OS.GetStockObject (OS.NULL_BRUSH));
             }
         }
     }
@@ -563,7 +563,7 @@
         bool drawImage = image !is null;
         bool drawSeparator = (style & DWT.SEPARATOR) !is 0 && (style & DWT.SHADOW_NONE) is 0;
         if (drawImage || drawSeparator) {
-            LRESULT result = LRESULT.NULL;
+            LRESULT result = null;
             PAINTSTRUCT ps;
             GCData data = new GCData ();
             data.ps = &ps;
@@ -626,7 +626,7 @@
     DRAWITEMSTRUCT* struct_ = cast(DRAWITEMSTRUCT*)lParam;
     drawBackground (struct_.hDC);
     if ((style & DWT.SEPARATOR) !is 0) {
-        if ((style & DWT.SHADOW_NONE) !is 0) return LRESULT.NULL;
+        if ((style & DWT.SHADOW_NONE) !is 0) return null;
         RECT rect;
         int lineWidth = OS.GetSystemMetrics (OS.SM_CXBORDER);
         int flags = (style & DWT.SHADOW_IN) !is 0 ? OS.EDGE_SUNKEN : OS.EDGE_ETCHED;
@@ -698,7 +698,7 @@
             }
         }
     }
-    return LRESULT.NULL;
+    return null;
 }
 
 }
--- a/dwt/widgets/Link.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/widgets/Link.d	Mon Feb 11 02:44:32 2008 +0100
@@ -163,10 +163,10 @@
     addListener (DWT.DefaultSelection, typedListener);
 }
 
-override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
-    if (handle is null) return LRESULT.NULL;
-    if (LinkProc !is null) return cast(LRESULT) OS.CallWindowProc (LinkProc, hwnd, msg, wParam, lParam);
-    return cast(LRESULT) OS.DefWindowProc (hwnd, msg, wParam, lParam);
+override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
+    if (handle is null) return 0;
+    if (LinkProc !is null) return OS.CallWindowProc (LinkProc, hwnd, msg, wParam, lParam);
+    return OS.DefWindowProc (hwnd, msg, wParam, lParam);
 }
 
 override public Point computeSize (int wHint, int hHint, bool changed) {
@@ -673,7 +673,7 @@
 
 override LRESULT WM_CHAR (int wParam, int lParam) {
     LRESULT result = super.WM_CHAR (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     if (OS.COMCTL32_MAJOR < 6) {
         if (focusIndex is -1) return result;
         switch (wParam) {
@@ -711,7 +711,7 @@
                 * performed in WM_KEYDOWN from WM_CHAR.
                 */
                 int code = callWindowProc (handle, OS.WM_KEYDOWN, wParam, lParam);
-                return cast(LRESULT) (code);
+                return new LRESULT (code);
             default:
         }
 
@@ -721,7 +721,7 @@
 
 override LRESULT WM_GETDLGCODE (int wParam, int lParam) {
     LRESULT result = super.WM_GETDLGCODE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     int index, count, code = 0;
     if (OS.COMCTL32_MAJOR >= 6) {
         LITEM item;
@@ -741,30 +741,30 @@
         count = offsets.length;
     }
     if (count is 0) {
-        return cast(LRESULT) (code | OS.DLGC_STATIC);
+        return new LRESULT (code | OS.DLGC_STATIC);
     }
     bool next = OS.GetKeyState (OS.VK_SHIFT) >= 0;
     if (next && index < count - 1) {
-        return cast(LRESULT) (code | OS.DLGC_WANTTAB);
+        return new LRESULT (code | OS.DLGC_WANTTAB);
     }
     if (!next && index > 0) {
-        return cast(LRESULT) (code | OS.DLGC_WANTTAB);
+        return new LRESULT (code | OS.DLGC_WANTTAB);
     }
     return result;
 }
 
 override LRESULT WM_GETFONT (int wParam, int lParam) {
     LRESULT result = super.WM_GETFONT (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     int code = callWindowProc (handle, OS.WM_GETFONT, wParam, lParam);
-    if (code !is 0) return cast(LRESULT) (code);
+    if (code !is 0) return new LRESULT (code);
     if (font is null) font = defaultFont ();
-    return cast(LRESULT) (font);
+    return new LRESULT ( cast(int) font);
 }
 
 override LRESULT WM_KEYDOWN (int wParam, int lParam) {
     LRESULT result = super.WM_KEYDOWN (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     if (OS.COMCTL32_MAJOR >= 6) {
         switch (wParam) {
             case OS.VK_SPACE:
@@ -957,11 +957,11 @@
     if (OS.COMCTL32_MAJOR >= 6) {
         if (!OS.IsWindowEnabled (handle)) {
             OS.SetTextColor (cast(HANDLE)wParam, OS.GetSysColor (OS.COLOR_GRAYTEXT));
-            if (result is LRESULT.NULL) {
+            if (result is null) {
                 int backPixel = getBackgroundPixel ();
                 OS.SetBkColor (cast(HANDLE)wParam, backPixel);
                 auto hBrush = findBrush (backPixel, OS.BS_SOLID);
-                return cast(LRESULT) (hBrush);
+                return new LRESULT ( cast(int) hBrush);
             }
         }
     }
@@ -982,7 +982,7 @@
             default:
         }
     }
-    return cast(LRESULT) super.wmNotifyChild (hdr, wParam, lParam);
+    return super.wmNotifyChild (hdr, wParam, lParam);
 }
 }
 
--- a/dwt/widgets/List.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/widgets/List.d	Mon Feb 11 02:44:32 2008 +0100
@@ -200,9 +200,9 @@
     addListener (DWT.DefaultSelection,typedListener);
 }
 
-override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
-    if (handle is null) return LRESULT.ZERO;
-    return cast(LRESULT) OS.CallWindowProc (ListProc, hwnd, msg, wParam, lParam);
+override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
+    if (handle is null) return 0;
+    return OS.CallWindowProc (ListProc, hwnd, msg, wParam, lParam);
 }
 
 static int checkStyle (int style) {
--- a/dwt/widgets/MenuItem.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/widgets/MenuItem.d	Mon Feb 11 02:44:32 2008 +0100
@@ -1166,7 +1166,7 @@
     Event event = new Event ();
     setInputState (event, DWT.Selection);
     postEvent (DWT.Selection, event);
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT wmDrawChild (int wParam, int lParam) {
@@ -1189,7 +1189,7 @@
         gc.dispose ();
     }
     if (parent.foreground !is -1) OS.SetTextColor (struct_.hDC, parent.foreground);
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT wmMeasureChild (int wParam, int lParam) {
@@ -1232,7 +1232,7 @@
         struct_.itemHeight = height + MARGIN_HEIGHT * 2;
         //OS.MoveMemory (lParam, struct_, MEASUREITEMSTRUCT.sizeof);
     }
-    return LRESULT.NULL;
+    return null;
 }
 
 }
--- a/dwt/widgets/ProgressBar.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/widgets/ProgressBar.d	Mon Feb 11 02:44:32 2008 +0100
@@ -130,9 +130,9 @@
     super (parent, checkStyle (style));
 }
 
-override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
-    if (handle is null) return LRESULT.ZERO;
-    return cast(LRESULT) OS.CallWindowProc (ProgressBarProc, hwnd, msg, wParam, lParam);
+override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
+    if (handle is null) return 0;
+    return OS.CallWindowProc (ProgressBarProc, hwnd, msg, wParam, lParam);
 }
 
 static int checkStyle (int style) {
@@ -324,7 +324,7 @@
 
 override LRESULT WM_GETDLGCODE (int wParam, int lParam) {
     LRESULT result = super.WM_GETDLGCODE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Feature in Windows.  The progress bar does
     * not implement WM_GETDLGCODE.  As a result,
@@ -334,12 +334,12 @@
     * implement WM_GETDLGCODE to behave like a
     * STATIC control.
     */
-    return cast(LRESULT) (OS.DLGC_STATIC);
+    return new LRESULT (OS.DLGC_STATIC);
 }
 
 override LRESULT WM_SIZE (int wParam, int lParam) {
     LRESULT result = super.WM_SIZE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Feature in Windows.  When a progress bar with the style
     * PBS_MARQUEE becomes too small, the animation (currently
@@ -375,7 +375,7 @@
 
 override LRESULT WM_TIMER (int wParam, int lParam) {
     LRESULT result = super.WM_TIMER (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     if ((style & DWT.INDETERMINATE) !is 0) {
         int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
         if (OS.COMCTL32_MAJOR < 6 || (bits & OS.PBS_MARQUEE) is 0) {
--- a/dwt/widgets/Sash.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/widgets/Sash.d	Mon Feb 11 02:44:32 2008 +0100
@@ -121,9 +121,9 @@
     addListener (DWT.DefaultSelection,typedListener);
 }
 
-override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
-    if (handle is null) return LRESULT.ZERO;
-    return cast(LRESULT) OS.DefWindowProc (hwnd, msg, wParam, lParam);
+override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
+    if (handle is null) return 0;
+    return OS.DefWindowProc (hwnd, msg, wParam, lParam);
 }
 
 override void createHandle () {
@@ -205,7 +205,7 @@
 
 override LRESULT WM_KEYDOWN (int wParam, int lParam) {
     LRESULT result = super.WM_KEYDOWN (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     switch (wParam) {
         case OS.VK_LEFT:
         case OS.VK_RIGHT:
@@ -271,7 +271,7 @@
 }
 
 override LRESULT WM_GETDLGCODE (int wParam, int lParam) {
-    return cast(LRESULT)(OS.DLGC_STATIC);
+    return new LRESULT (OS.DLGC_STATIC);
 }
 
 override LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
@@ -360,7 +360,7 @@
 
 override LRESULT WM_MOUSEMOVE (int wParam, int lParam) {
     LRESULT result = super.WM_MOUSEMOVE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     if (!dragging || (wParam & OS.MK_LBUTTON) is 0) return result;
 
     /* Compute the banding rectangle */
@@ -416,7 +416,7 @@
 
 override LRESULT WM_SETCURSOR (int wParam, int lParam) {
     LRESULT result = super.WM_SETCURSOR (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     int hitTest = lParam & 0xFFFF;
     if (hitTest is OS.HTCLIENT) {
         HCURSOR hCursor;
--- a/dwt/widgets/Scale.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/widgets/Scale.d	Mon Feb 11 02:44:32 2008 +0100
@@ -163,9 +163,9 @@
     addListener (DWT.DefaultSelection,typedListener);
 }
 
-override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
-    if (handle is null) return LRESULT.ZERO;
-    return cast(LRESULT)OS.CallWindowProc (TrackBarProc, hwnd, msg, wParam, lParam);
+override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
+    if (handle is null) return 0;
+    return OS.CallWindowProc (TrackBarProc, hwnd, msg, wParam, lParam);
 }
 
 static int checkStyle (int style) {
@@ -484,7 +484,7 @@
 }
 
 override LRESULT WM_SIZE (int wParam, int lParam) {
-    if (ignoreResize) return LRESULT.NULL;
+    if (ignoreResize) return null;
     return super.WM_SIZE (wParam, lParam);
 }
 
@@ -495,7 +495,7 @@
     switch (code) {
         case OS.TB_ENDTRACK:
         case OS.TB_THUMBPOSITION:
-            return LRESULT.NULL;
+            return null;
         default:
     }
 
@@ -522,7 +522,7 @@
     */
     sendEvent (DWT.Selection, event);
     // widget could be disposed at this point
-    return LRESULT.NULL;
+    return null;
 }
 
 }
--- a/dwt/widgets/ScrollBar.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/widgets/ScrollBar.d	Mon Feb 11 02:44:32 2008 +0100
@@ -903,7 +903,7 @@
 
     /* Do nothing when scrolling is ending */
     int code = wParam & 0xFFFF;
-    if (code is OS.SB_ENDSCROLL) return LRESULT.NULL;
+    if (code is OS.SB_ENDSCROLL) return null;
 
     /*
     * Send the event because WM_HSCROLL and
@@ -925,7 +925,7 @@
     }
     sendEvent (DWT.Selection, event);
     // the widget could be destroyed at this point
-    return LRESULT.NULL;
+    return null;
 }
 
 }
--- a/dwt/widgets/Scrollable.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/widgets/Scrollable.d	Mon Feb 11 02:44:32 2008 +0100
@@ -88,9 +88,9 @@
     super (parent, style);
 }
 
-override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
-    if (handle is null) return LRESULT.ZERO;
-    return cast(LRESULT) OS.DefWindowProc (hwnd, msg, wParam, lParam);
+override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
+    if (handle is null) return 0;
+    return OS.DefWindowProc (hwnd, msg, wParam, lParam);
 }
 
 /**
@@ -261,7 +261,7 @@
 override LRESULT WM_HSCROLL (int wParam, int lParam) {
 trc(__LINE__);
     LRESULT result = super.WM_HSCROLL (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
 
     /*
     * Bug on WinCE.  lParam should be NULL when the message is not sent
@@ -279,7 +279,7 @@
 override LRESULT WM_MOUSEWHEEL (int wParam, int lParam) {
 trc(__LINE__);
     LRESULT result = super.WM_MOUSEWHEEL (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
 
     /*
     * Translate WM_MOUSEWHEEL to WM_VSCROLL or WM_HSCROLL.
@@ -326,7 +326,7 @@
     */
     int vPosition = verticalBar is null ? 0 : verticalBar.getSelection ();
     int hPosition = horizontalBar is null ? 0 : horizontalBar.getSelection ();
-    LRESULT code = callWindowProc (handle, OS.WM_MOUSEWHEEL, wParam, lParam);
+    int code = callWindowProc (handle, OS.WM_MOUSEWHEEL, wParam, lParam);
     if (verticalBar !is null) {
         int position = verticalBar.getSelection ();
         if (position !is vPosition) {
@@ -343,23 +343,22 @@
             horizontalBar.sendEvent (DWT.Selection, event);
         }
     }
-    return code;
+    return new LRESULT (code);
 }
 
 override LRESULT WM_SIZE (int wParam, int lParam) {
 trc(__LINE__);
-    LRESULT code = callWindowProc (handle, OS.WM_SIZE, wParam, lParam);
-    assert( code !is LRESULT.NULL );
+    int code = callWindowProc (handle, OS.WM_SIZE, wParam, lParam);
     super.WM_SIZE (wParam, lParam);
     // widget may be disposed at this point
     if (code is 0) return LRESULT.ZERO;
-    return code;
+    return new LRESULT (code);
 }
 
 override LRESULT WM_VSCROLL (int wParam, int lParam) {
 trc(__LINE__);
     LRESULT result = super.WM_VSCROLL (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Bug on WinCE.  lParam should be NULL when the message is not sent
     * by a scroll bar control, but it contains the handle to the window.
@@ -375,7 +374,7 @@
 
 LRESULT wmScroll (ScrollBar bar, bool update, HWND hwnd, int msg, int wParam, int lParam) {
 trc(__LINE__);
-    LRESULT result = LRESULT.NULL;
+    LRESULT result = null;
     if (update) {
         int type = msg is OS.WM_HSCROLL ? OS.SB_HORZ : OS.SB_VERT;
         SCROLLINFO info;
@@ -385,7 +384,7 @@
         info.fMask = OS.SIF_POS;
         int code = wParam & 0xFFFF;
         switch (code) {
-            case OS.SB_ENDSCROLL:  return LRESULT.NULL;
+            case OS.SB_ENDSCROLL:  return null;
             case OS.SB_THUMBPOSITION:
             case OS.SB_THUMBTRACK:
                 /*
@@ -420,8 +419,8 @@
         }
         OS.SetScrollInfo (hwnd, type, &info, true);
     } else {
-        LRESULT code = callWindowProc (hwnd, msg, wParam, lParam);
-        result = code is 0 ? LRESULT.ZERO : code;
+        int code = callWindowProc (hwnd, msg, wParam, lParam);
+        result = code is 0 ? LRESULT.ZERO : new LRESULT (code);
     }
     bar.wmScrollChild (wParam, lParam);
     return result;
--- a/dwt/widgets/Shell.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/widgets/Shell.d	Mon Feb 11 02:44:32 2008 +0100
@@ -479,31 +479,31 @@
     return balloonTipHandle_;
 }
 
-override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
-    if (handle is null) return LRESULT.ZERO;
+override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
+    if (handle is null) return 0;
     if (hwnd is toolTipHandle_ || hwnd is balloonTipHandle_) {
-        return cast(LRESULT) ToolTipProc( hwnd, msg, wParam, lParam);
+        return OS.CallWindowProc (ToolTipProc, hwnd, msg, wParam, lParam);
     }
     if (hwndMDIClient_ !is null) {
-        return cast(LRESULT) OS.DefFrameProc (hwnd, hwndMDIClient_, msg, wParam, lParam);
+        return OS.DefFrameProc (hwnd, hwndMDIClient_, msg, wParam, lParam);
     }
     if (windowProc_ !is null) {
-        return cast(LRESULT) windowProc_( hwnd, msg, wParam, lParam);
+        return OS.CallWindowProc (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 cast(LRESULT) OS.DefWindowProc (hwnd, msg, wParam, lParam);
+        if ((style & trim) is 0) return OS.DefWindowProc (hwnd, msg, wParam, lParam);
     }
     if (parent !is null) {
         switch (msg) {
             case OS.WM_KILLFOCUS:
             case OS.WM_SETFOCUS:
-                return cast(LRESULT) OS.DefWindowProc (hwnd, msg, wParam, lParam);
+                return OS.DefWindowProc (hwnd, msg, wParam, lParam);
             default:
         }
-        return cast(LRESULT) DialogProc( hwnd, msg, wParam, lParam);
+        return OS.CallWindowProc (DialogProc, hwnd, msg, wParam, lParam);
     }
-    return cast(LRESULT) OS.DefWindowProc (hwnd, msg, wParam, lParam);
+    return OS.DefWindowProc (hwnd, msg, wParam, lParam);
 }
 
 /**
@@ -1957,7 +1957,7 @@
 
 override LRESULT WM_ERASEBKGND (int wParam, int lParam) {
     LRESULT result = super.WM_ERASEBKGND (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Feature in Windows.  When a shell is resized by dragging
     * the resize handles, Windows temporarily fills in black
@@ -1975,7 +1975,7 @@
 
 override LRESULT WM_ENTERIDLE (int wParam, int lParam) {
     LRESULT result = super.WM_ENTERIDLE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     if (OS.IsWinCE && display.runMessages) {
         if (display.runAsyncMessages (true)) display.wakeThread ();
     }
@@ -1984,7 +1984,7 @@
 
 override LRESULT WM_GETMINMAXINFO (int wParam, int lParam) {
     LRESULT result = super.WM_GETMINMAXINFO (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is 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 +1998,7 @@
 
 override LRESULT WM_MOUSEACTIVATE (int wParam, int lParam) {
     LRESULT result = super.WM_MOUSEACTIVATE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
 
     /*
     * Check for WM_MOUSEACTIVATE when an MDI shell is active
@@ -2021,17 +2021,17 @@
                     display.lastHittestControl = null;
                     if (hittest is OS.HTMENU || hittest is OS.HTSYSMENU) {
                         display.lastHittestControl = control;
-                        return LRESULT.NULL;
+                        return null;
                     }
                     if (OS.IsWin95 && hittest is OS.HTCAPTION) {
                         display.lastHittestControl = control;
                     }
-                    return cast( LRESULT )(OS.MA_NOACTIVATE);
+                    return new LRESULT (OS.MA_NOACTIVATE);
                 }
             }
         }
     }
-    if (hittest is OS.HTMENU) return LRESULT.NULL;
+    if (hittest is OS.HTMENU) return null;
 
     /*
     * Get the current location of the cursor,
@@ -2052,7 +2052,7 @@
         pt.y = cast(short) (pos >> 16);
     }
     auto hwnd = OS.WindowFromPoint (pt);
-    if (hwnd is null) return LRESULT.NULL;
+    if (hwnd is null) return null;
     Control control = display.findControl (hwnd);
 
     /*
@@ -2066,19 +2066,19 @@
             int bits = DWT.ON_TOP | DWT.NO_FOCUS;
             if ((style & bits) is bits) {
                 if (hittest is OS.HTBORDER || hittest is OS.HTCLIENT) {
-                    return cast( LRESULT )(OS.MA_NOACTIVATE);
+                    return new LRESULT (OS.MA_NOACTIVATE);
                 }
             }
         }
     }
 
     setActiveControl (control);
-    return LRESULT.NULL;
+    return null;
 }
 
 override LRESULT WM_MOVE (int wParam, int lParam) {
     LRESULT result = super.WM_MOVE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     ToolTip tip = getCurrentToolTip ();
     if (tip !is null) tip.setVisible (false);
     return result;
@@ -2101,24 +2101,24 @@
 }
 
 override LRESULT WM_NCHITTEST (int wParam, int lParam) {
-    if (!OS.IsWindowEnabled (handle)) return LRESULT.NULL;
+    if (!OS.IsWindowEnabled (handle)) return null;
     if (!isEnabled () || !isActive ()) {
-        if (!Display.TrimEnabled) return cast( LRESULT )(OS.HTNOWHERE);
+        if (!Display.TrimEnabled) return new 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 cast( LRESULT )(hittest);
+        return new 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 cast( LRESULT )(hittest);
+        return new LRESULT (hittest);
     }
-    return LRESULT.NULL;
+    return null;
 }
 
 override LRESULT WM_NCLBUTTONDOWN (int wParam, int lParam) {
     LRESULT result = super.WM_NCLBUTTONDOWN (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is 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 +2141,7 @@
     }
     display.lastHittestControl = null;
     display.ignoreRestoreFocus = false;
-    return cast( LRESULT )(code);
+    return new LRESULT (code);
 }
 
 override LRESULT WM_PALETTECHANGED (int wParam, int lParam) {
@@ -2234,7 +2234,7 @@
 
 override LRESULT WM_SETTINGCHANGE (int wParam, int lParam) {
     LRESULT result = super.WM_SETTINGCHANGE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     static if (OS.IsPPC) {
         if (wParam is OS.SPI_SETSIPINFO) {
             /*
@@ -2259,7 +2259,7 @@
 
 override LRESULT WM_SHOWWINDOW (int wParam, int lParam) {
     LRESULT result = super.WM_SHOWWINDOW (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is 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 +2281,7 @@
 
 override LRESULT WM_SYSCOMMAND (int wParam, int lParam) {
     LRESULT result = super.WM_SYSCOMMAND (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Feature in Windows.  When the last visible window in
     * a process minimized, Windows swaps out the memory for
@@ -2316,7 +2316,7 @@
 
 override LRESULT WM_WINDOWPOSCHANGING (int wParam, int lParam) {
     LRESULT result = super.WM_WINDOWPOSCHANGING (wParam,lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is 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 00:56:33 2008 +0100
+++ b/dwt/widgets/Slider.d	Mon Feb 11 02:44:32 2008 +0100
@@ -175,8 +175,8 @@
     addListener (DWT.DefaultSelection,typedListener);
 }
 
-override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
-    if (handle is null) return LRESULT.ZERO;
+override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
+    if (handle is null) return 0;
     /*
     * Feature in Windows.  Windows runs a modal message
     * loop when the user drags a scroll bar.  This means
@@ -191,7 +191,7 @@
             display.runDeferredEvents ();
         default:
     }
-    return cast(LRESULT) OS.CallWindowProc (ScrollBarProc, hwnd, msg, wParam, lParam);
+    return OS.CallWindowProc (ScrollBarProc, hwnd, msg, wParam, lParam);
 }
 
 static int checkStyle (int style) {
@@ -653,7 +653,7 @@
 
 override LRESULT WM_KEYDOWN (int wParam, int lParam) {
     LRESULT result = super.WM_KEYDOWN (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     if ((style & DWT.VERTICAL) !is 0) return result;
     /*
     * Bug in Windows.  When a horizontal scroll bar is mirrored,
@@ -670,7 +670,7 @@
             case OS.VK_RIGHT: {
                 int key = wParam is OS.VK_LEFT ? OS.VK_RIGHT : OS.VK_LEFT;
                 int code = callWindowProc (handle, OS.WM_KEYDOWN, key, lParam);
-                return cast(LRESULT) (code);
+                return new LRESULT (code);
             }
             default:
         }
@@ -745,7 +745,7 @@
 }
 
 override LRESULT WM_SETFOCUS (int wParam, int lParam) {
-    if (ignoreFocus) return LRESULT.NULL;
+    if (ignoreFocus) return null;
     return super.WM_SETFOCUS (wParam, lParam);
 }
 
@@ -753,7 +753,7 @@
 
     /* Do nothing when scrolling is ending */
     int code = wParam & 0xFFFF;
-    if (code is OS.SB_ENDSCROLL) return LRESULT.NULL;
+    if (code is OS.SB_ENDSCROLL) return null;
 
     /* Move the thumb */
     Event event = new Event ();
@@ -808,7 +808,7 @@
     */
     sendEvent (DWT.Selection, event);
     // the widget could be destroyed at this point
-    return LRESULT.NULL;
+    return null;
 }
 
 }
--- a/dwt/widgets/Spinner.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/widgets/Spinner.d	Mon Feb 11 02:44:32 2008 +0100
@@ -123,15 +123,15 @@
     super (parent, checkStyle (style));
 }
 
-override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
-    if (handle is null) return LRESULT.ZERO;
+override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
+    if (handle is null) return 0;
     if (hwnd is hwndText) {
-        return cast(LRESULT) OS.CallWindowProc (EditProc, hwnd, msg, wParam, lParam);
+        return OS.CallWindowProc (EditProc, hwnd, msg, wParam, lParam);
     }
     if (hwnd is hwndUpDown) {
-        return cast(LRESULT) OS.CallWindowProc (UpDownProc, hwnd, msg, wParam, lParam);
+        return OS.CallWindowProc (UpDownProc, hwnd, msg, wParam, lParam);
     }
-    return cast(LRESULT) OS.DefWindowProc (handle, msg, wParam, lParam);
+    return OS.DefWindowProc (handle, msg, wParam, lParam);
 }
 
 static int checkStyle (int style) {
@@ -1087,7 +1087,7 @@
 
 override int windowProc (HWND hwnd, int msg, int wParam, int lParam) {
     if (hwnd is hwndText || hwnd is hwndUpDown) {
-        LRESULT result = LRESULT.NULL;
+        LRESULT result = null;
         switch (msg) {
             /* Keyboard messages */
             case OS.WM_CHAR:        result = wmChar (hwnd, wParam, lParam); break;
@@ -1140,7 +1140,7 @@
                 break;
             default:
         }
-        if (result !is LRESULT.NULL) return result;
+        if (result !is null) return result.value;
         return callWindowProc (hwnd, msg, wParam, lParam);
     }
     return super.windowProc (hwnd, msg, wParam, lParam);
@@ -1153,17 +1153,17 @@
 }
 
 override LRESULT WM_KILLFOCUS (int wParam, int lParam) {
-    return LRESULT.NULL;
+    return null;
 }
 
 override LRESULT WM_SETFOCUS (int wParam, int lParam) {
     OS.SetFocus (hwndText);
-    return LRESULT.NULL;
+    return null;
 }
 
 override LRESULT WM_SETFONT (int wParam, int lParam) {
     LRESULT result = super.WM_SETFONT (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     OS.SendMessage (hwndText, OS.WM_SETFONT, wParam, lParam);
     return result;
 }
@@ -1183,7 +1183,7 @@
 
 override LRESULT wmChar (HWND hwnd, int wParam, int lParam) {
     LRESULT result = super.wmChar (hwnd, wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Feature in Windows.  For some reason, when the
     * widget is a single line text widget, when the
@@ -1203,7 +1203,7 @@
 }
 
 LRESULT wmClipboard (HWND hwndText, int msg, int wParam, int lParam) {
-    if ((style & DWT.READ_ONLY) !is 0) return LRESULT.NULL;
+    if ((style & DWT.READ_ONLY) !is 0) return null;
 //  if (!hooks (DWT.Verify) && !filters (DWT.Verify)) return null;
     bool call = false;
     int start, end;
@@ -1259,14 +1259,14 @@
                 OS.MoveMemory (pszText, buffer.ptr, byteCount);
                 int code = OS.CallWindowProc (EditProc, hwndText, msg, wParam, cast(int) pszText);
                 OS.HeapFree (hHeap, 0, pszText);
-                return cast(LRESULT) (code);
+                return new LRESULT (code);
             } else {
                 OS.SendMessage (hwndText, OS.EM_REPLACESEL, 0, buffer.ptr);
                 return LRESULT.ZERO;
             }
         }
     }
-    return LRESULT.NULL;
+    return null;
 }
 
 override LRESULT wmCommandChild (int wParam, int lParam) {
@@ -1294,7 +1294,7 @@
 
 override LRESULT wmKeyDown (HWND hwnd, int wParam, int lParam) {
     LRESULT result = super.wmKeyDown (hwnd, wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
 
     /* Increment the value */
     UDACCEL udaccel;
--- a/dwt/widgets/TabFolder.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/widgets/TabFolder.d	Mon Feb 11 02:44:32 2008 +0100
@@ -184,9 +184,9 @@
     addListener(DWT.DefaultSelection,typedListener);
 }
 
-override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
-    if (handle is null) return LRESULT.ZERO;
-    return cast(LRESULT) OS.CallWindowProc (TabFolderProc, hwnd, msg, wParam, lParam);
+override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
+    if (handle is null) return 0;
+    return OS.CallWindowProc (TabFolderProc, hwnd, msg, wParam, lParam);
 }
 
 static int checkStyle (int style) {
@@ -788,13 +788,13 @@
     * processed without needing to press the ALT key
     * when the widget has focus.
     */
-    if (result !is LRESULT.NULL) return result;
-    return cast(LRESULT) (OS.DLGC_BUTTON);
+    if (result !is null) return result;
+    return new LRESULT (OS.DLGC_BUTTON);
 }
 
 override LRESULT WM_MOUSELEAVE (int wParam, int lParam) {
     LRESULT result = super.WM_MOUSELEAVE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Bug in Windows.  On XP, when a tooltip is
     * hidden due to a time out or mouse press,
@@ -822,7 +822,7 @@
 
 override LRESULT WM_NCHITTEST (int wParam, int lParam) {
     LRESULT result = super.WM_NCHITTEST (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Feature in Windows.  The tab control implements
     * WM_NCHITTEST to return HTCLIENT when the cursor
@@ -836,7 +836,7 @@
     * the mouse is in the client area.
     */
     int hittest = OS.DefWindowProc (handle, OS.WM_NCHITTEST, wParam, lParam);
-    return cast(LRESULT) (hittest);
+    return new LRESULT (hittest);
 }
 
 override LRESULT WM_NOTIFY (int wParam, int lParam) {
@@ -859,13 +859,13 @@
     * for this control.
     */
     LRESULT result = super.WM_NOTIFY (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     return LRESULT.ZERO;
 }
 
 override LRESULT WM_PARENTNOTIFY (int wParam, int lParam) {
     LRESULT result = super.WM_PARENTNOTIFY (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Feature in Windows.  Windows does not explicitly set the orientation of
     * the buddy control.  Instead, the orientation is inherited when WS_EX_LAYOUTRTL
@@ -918,7 +918,7 @@
 
 override LRESULT WM_WINDOWPOSCHANGING (int wParam, int lParam) {
     LRESULT result = super.WM_WINDOWPOSCHANGING (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     if (!OS.IsWindowVisible (handle)) return result;
     WINDOWPOS* lpwp = cast(WINDOWPOS*)lParam;
     //OS.MoveMemory (lpwp, lParam, WINDOWPOS.sizeof);
--- a/dwt/widgets/Table.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/widgets/Table.d	Mon Feb 11 02:44:32 2008 +0100
@@ -224,14 +224,14 @@
     addListener (DWT.DefaultSelection,typedListener);
 }
 
-override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
+override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
     return callWindowProc (hwnd, msg, wParam, lParam, false);
 }
 
-LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam, bool forceSelect) {
-    if (handle is null) return LRESULT.ZERO;
+int callWindowProc (HWND hwnd, int msg, int wParam, int lParam, bool forceSelect) {
+    if (handle is null) return 0;
     if (handle !is hwnd) {
-        return cast(LRESULT) OS.CallWindowProc (HeaderProc, hwnd, msg, wParam, lParam);
+        return OS.CallWindowProc (HeaderProc, hwnd, msg, wParam, lParam);
     }
     int topIndex = 0;
     bool checkSelection = false, checkActivate = false, redraw = false;
@@ -365,7 +365,7 @@
         }
         default:
     }
-    return cast(LRESULT) code;
+    return code;
 }
 
 static int checkStyle (int style) {
@@ -438,7 +438,7 @@
             }
         }
     }
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT CDDS_ITEMPREPAINT (NMLVCUSTOMDRAW* nmcd, int wParam, int lParam) {
@@ -478,11 +478,11 @@
             OS.DeleteObject (hrgn);
         }
     }
-    return cast(LRESULT) (OS.CDRF_NOTIFYSUBITEMDRAW | OS.CDRF_NOTIFYPOSTPAINT);
+    return new LRESULT (OS.CDRF_NOTIFYSUBITEMDRAW | OS.CDRF_NOTIFYPOSTPAINT);
 }
 
 LRESULT CDDS_POSTPAINT (NMLVCUSTOMDRAW* nmcd, int wParam, int lParam) {
-    if (ignoreCustomDraw) return LRESULT.NULL;
+    if (ignoreCustomDraw) return null;
     /*
     * Bug in Windows.  When the table has the extended style
     * LVS_EX_FULLROWSELECT and LVM_SETBKCOLOR is used with
@@ -515,12 +515,12 @@
             }
         }
     }
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT CDDS_PREPAINT (NMLVCUSTOMDRAW* nmcd, int wParam, int lParam) {
     if (ignoreCustomDraw) {
-        return cast(LRESULT) (OS.CDRF_NOTIFYITEMDRAW | OS.CDRF_NOTIFYPOSTPAINT);
+        return new LRESULT (OS.CDRF_NOTIFYITEMDRAW | OS.CDRF_NOTIFYPOSTPAINT);
     }
     /*
     * Bug in Windows.  When the table has the extended style
@@ -611,12 +611,12 @@
             }
         }
     }
-    return cast(LRESULT) (OS.CDRF_NOTIFYITEMDRAW | OS.CDRF_NOTIFYPOSTPAINT);
+    return new LRESULT (OS.CDRF_NOTIFYITEMDRAW | OS.CDRF_NOTIFYPOSTPAINT);
 }
 
 LRESULT CDDS_SUBITEMPOSTPAINT (NMLVCUSTOMDRAW* nmcd, int wParam, int lParam) {
-    if (ignoreCustomDraw) return LRESULT.NULL;
-    if (nmcd.nmcd.rc.left is nmcd.nmcd.rc.right) return cast(LRESULT) (OS.CDRF_DODEFAULT);
+    if (ignoreCustomDraw) return null;
+    if (nmcd.nmcd.rc.left is nmcd.nmcd.rc.right) return new LRESULT (OS.CDRF_DODEFAULT);
     auto hDC = nmcd.nmcd.hdc;
     if (ignoreDrawForeground) OS.RestoreDC (hDC, -1);
     if (OS.IsWindowVisible (handle)) {
@@ -654,7 +654,7 @@
             //widget could be disposed at this point
         }
     }
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT CDDS_SUBITEMPREPAINT (NMLVCUSTOMDRAW* nmcd, int wParam, int lParam) {
@@ -671,12 +671,12 @@
     * null.
     */
     TableItem item = _getItem (nmcd.nmcd.dwItemSpec);
-    if (item is null) return LRESULT.NULL;
+    if (item is null) return null;
     HFONT hFont = item.cellFont !is null ? item.cellFont [nmcd.iSubItem] : cast(HFONT)-1;
     if (hFont is cast(HFONT)-1) hFont = item.font;
     if (hFont !is cast(HFONT)-1) OS.SelectObject (hDC, hFont);
     if (ignoreCustomDraw || (nmcd.nmcd.rc.left is nmcd.nmcd.rc.right)) {
-        return cast(LRESULT) (hFont is cast(HFONT)-1 ? OS.CDRF_DODEFAULT : OS.CDRF_NEWFONT);
+        return new LRESULT (hFont is cast(HFONT)-1 ? OS.CDRF_DODEFAULT : OS.CDRF_NEWFONT);
     }
     int code = OS.CDRF_DODEFAULT;
     selectionForeground = -1;
@@ -684,11 +684,11 @@
     if (OS.IsWindowVisible (handle)) {
         if (hooks (DWT.MeasureItem)) {
             sendMeasureItemEvent (item, nmcd.nmcd.dwItemSpec, nmcd.iSubItem, nmcd.nmcd.hdc);
-            if (isDisposed () || item.isDisposed ()) return LRESULT.NULL;
+            if (isDisposed () || item.isDisposed ()) return null;
         }
         if (hooks (DWT.EraseItem)) {
             sendEraseItemEvent (item, nmcd, lParam);
-            if (isDisposed () || item.isDisposed ()) return LRESULT.NULL;
+            if (isDisposed () || item.isDisposed ()) return null;
             code |= OS.CDRF_NOTIFYPOSTPAINT;
         }
         if (ignoreDrawForeground || hooks (DWT.PaintItem)) code |= OS.CDRF_NOTIFYPOSTPAINT;
@@ -829,7 +829,7 @@
         OS.MoveMemory (lParam, nmcd, NMLVCUSTOMDRAW.sizeof);
         code |= OS.CDRF_NEWFONT;
     }
-    return cast(LRESULT) (code);
+    return new LRESULT (code);
 }
 
 override void checkBuffered () {
@@ -3385,7 +3385,7 @@
         }
     }
     dragStarted = false;
-    return cast(LRESULT) (code);
+    return new LRESULT (code);
 }
 
 void sendPaintItemEvent (TableItem item, NMLVCUSTOMDRAW* nmcd) {
@@ -5073,7 +5073,7 @@
 
 override LRESULT WM_CHAR (int wParam, int lParam) {
     LRESULT result = super.WM_CHAR (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     switch (wParam) {
         case ' ':
             if ((style & DWT.CHECK) !is 0) {
@@ -5093,7 +5093,7 @@
             * performed in WM_KEYDOWN from WM_CHAR.
             */
             int code = callWindowProc (handle, OS.WM_KEYDOWN, wParam, lParam);
-            return cast(LRESULT) (code);
+            return new LRESULT (code);
         case DWT.CR:
             /*
             * Feature in Windows.  Windows sends LVN_ITEMACTIVATE from WM_KEYDOWN
@@ -5157,7 +5157,7 @@
 
 override LRESULT WM_KEYDOWN (int wParam, int lParam) {
     LRESULT result = super.WM_KEYDOWN (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     switch (wParam) {
         case OS.VK_SPACE:
             /*
@@ -5209,7 +5209,7 @@
                 oldHeaderProc = OS.SetWindowLong (hwndHeader, OS.GWL_WNDPROC, cast(int) HeaderProc);
             }
             int code = callWindowProc (handle, OS.WM_KEYDOWN, wParam, lParam);
-            result = code is 0 ? LRESULT.ZERO : cast(LRESULT) (code);
+            result = code is 0 ? LRESULT.ZERO : new LRESULT (code);
             if (fixSubclass) {
                 OS.SetWindowLong (handle, OS.GWL_WNDPROC, oldTableProc);
                 OS.SetWindowLong (hwndHeader, OS.GWL_WNDPROC, oldHeaderProc);
@@ -5483,7 +5483,7 @@
 
 override LRESULT WM_SETFONT (int wParam, int lParam) {
     LRESULT result = super.WM_SETFONT (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
 
     /*
     * Bug in Windows.  When a header has a sort indicator
@@ -5506,20 +5506,20 @@
 }
 
 override LRESULT WM_SIZE (int wParam, int lParam) {
-    if (ignoreResize) return LRESULT.NULL;
+    if (ignoreResize) return null;
     if (hooks (DWT.EraseItem) || hooks (DWT.PaintItem)) {
         OS.InvalidateRect (handle, null, true);
     }
     if (resizeCount !is 0) {
         wasResized = true;
-        return LRESULT.NULL;
+        return null;
     }
     return super.WM_SIZE (wParam, lParam);
 }
 
 override LRESULT WM_SYSCOLORCHANGE (int wParam, int lParam) {
     LRESULT result = super.WM_SYSCOLORCHANGE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     if (findBackgroundControl () is null) {
         setBackgroundPixel (defaultBackground ());
     } else {
@@ -5675,7 +5675,7 @@
         struct_.itemHeight = itemHeight;
     }
     //OS.MoveMemory (lParam, struct_, MEASUREITEMSTRUCT.sizeof);
-    return LRESULT.NULL;
+    return null;
 }
 
 override LRESULT wmNotify (NMHDR* hdr, int wParam, int lParam) {
@@ -5857,14 +5857,14 @@
         }
     }
     LRESULT result = super.wmNotify (hdr, wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     switch (hdr.code) {
         case OS.TTN_GETDISPINFOA:
         case OS.TTN_GETDISPINFOW: {
             tipRequested = true;
             int code = callWindowProc (handle, OS.WM_NOTIFY, wParam, lParam);
             tipRequested = false;
-            return cast(LRESULT) (code);
+            return new LRESULT (code);
         }
         default:
     }
@@ -5875,7 +5875,7 @@
     switch (hdr.code) {
         case OS.LVN_ODFINDITEMA:
         case OS.LVN_ODFINDITEMW: {
-            if ((style & DWT.VIRTUAL) !is 0) return cast(LRESULT) (-1);
+            if ((style & DWT.VIRTUAL) !is 0) return new LRESULT (-1);
             break;
         }
         case OS.LVN_ODSTATECHANGED: {
--- a/dwt/widgets/Text.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/widgets/Text.d	Mon Feb 11 02:44:32 2008 +0100
@@ -164,9 +164,9 @@
     super (parent, checkStyle (style));
 }
 
-override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
-    if (handle is null) return LRESULT.ZERO;
-    return cast(LRESULT) OS.CallWindowProc (EditProc, hwnd, msg, wParam, lParam);
+override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
+    if (handle is null) return 0;
+    return OS.CallWindowProc (EditProc, hwnd, msg, wParam, lParam);
 }
 
 override void createHandle () {
@@ -2035,7 +2035,7 @@
         int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
         if ((bits & OS.ES_MULTILINE) is 0) {
             LRESULT result = wmClipboard (OS.EM_UNDO, wParam, lParam);
-            if (result !is LRESULT.NULL) return result;
+            if (result !is null) return result.value;
             return callWindowProc (hwnd, OS.EM_UNDO, wParam, lParam);
         }
     }
@@ -2048,9 +2048,9 @@
 }
 
 override LRESULT WM_CHAR (int wParam, int lParam) {
-    if (ignoreCharacter) return LRESULT.NULL;
+    if (ignoreCharacter) return null;
     LRESULT result = super.WM_CHAR (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
 
     /*
     * Bug in Windows.  When the user types CTRL and BS
@@ -2089,13 +2089,13 @@
 
 override LRESULT WM_CLEAR (int wParam, int lParam) {
     LRESULT result = super.WM_CLEAR (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     return wmClipboard (OS.WM_CLEAR, wParam, lParam);
 }
 
 override LRESULT WM_CUT (int wParam, int lParam) {
     LRESULT result = super.WM_CUT (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     return wmClipboard (OS.WM_CUT, wParam, lParam);
 }
 
@@ -2127,7 +2127,7 @@
 
 override LRESULT WM_GETDLGCODE (int wParam, int lParam) {
     LRESULT result = super.WM_GETDLGCODE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
 
     /*
     * Bug in WinCE PPC.  For some reason, sending WM_GETDLGCODE
@@ -2137,7 +2137,7 @@
     */
     if (OS.IsPPC) {
         if ((style & DWT.MULTI) !is 0 && (style & DWT.READ_ONLY) is 0 && lParam is 0) {
-            return cast(LRESULT) (OS.DLGC_HASSETSEL | OS.DLGC_WANTALLKEYS | OS.DLGC_WANTCHARS);
+            return new LRESULT (OS.DLGC_HASSETSEL | OS.DLGC_WANTALLKEYS | OS.DLGC_WANTCHARS);
         }
     }
 
@@ -2153,9 +2153,9 @@
     if ((style & DWT.READ_ONLY) !is 0) {
         int code = callWindowProc (handle, OS.WM_GETDLGCODE, wParam, lParam);
         code &= ~(OS.DLGC_WANTALLKEYS | OS.DLGC_WANTTAB);
-        return cast(LRESULT) (code);
+        return new LRESULT (code);
     }
-    return LRESULT.NULL;
+    return null;
 }
 
 override LRESULT WM_IME_CHAR (int wParam, int lParam) {
@@ -2189,7 +2189,7 @@
     sendKeyEvent (DWT.KeyUp, OS.WM_IME_CHAR, wParam, lParam);
     // widget could be disposed at this point
     display.lastKey = display.lastAscii = 0;
-    return cast(LRESULT) (result);
+    return new LRESULT (result);
 }
 
 override LRESULT WM_LBUTTONDBLCLK (int wParam, int lParam) {
@@ -2198,7 +2198,7 @@
     * when double clicking behavior is disabled by not
     * calling the window proc.
     */
-    LRESULT result = LRESULT.NULL;
+    LRESULT result = null;
     sendMouseEvent (DWT.MouseDown, 1, handle, OS.WM_LBUTTONDOWN, wParam, lParam);
     if (!sendMouseEvent (DWT.MouseDoubleClick, 1, handle, OS.WM_LBUTTONDBLCLK, wParam, lParam)) {
         result = LRESULT.ZERO;
@@ -2233,7 +2233,7 @@
 override LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
     static if( OS.IsWinCE )
     if (OS.IsPPC) {
-        LRESULT result = LRESULT.NULL;
+        LRESULT result = null;
         Display display = this.display;
         display.captureChanged = false;
         bool dispatch = sendMouseEvent (DWT.MouseDown, 1, handle, OS.WM_LBUTTONDOWN, wParam, lParam);
@@ -2263,7 +2263,7 @@
             }
         }
         if (dispatch) {
-            result = cast(LRESULT) (callWindowProc (handle, OS.WM_LBUTTONDOWN, wParam, lParam));
+            result = new LRESULT (callWindowProc (handle, OS.WM_LBUTTONDOWN, wParam, lParam));
         } else {
             result = LRESULT.ZERO;
         }
@@ -2277,19 +2277,19 @@
 
 override LRESULT WM_PASTE (int wParam, int lParam) {
     LRESULT result = super.WM_PASTE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     return wmClipboard (OS.WM_PASTE, wParam, lParam);
 }
 
 override LRESULT WM_UNDO (int wParam, int lParam) {
     LRESULT result = super.WM_UNDO (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     return wmClipboard (OS.WM_UNDO, wParam, lParam);
 }
 
 LRESULT wmClipboard (int msg, int wParam, int lParam) {
-    if ((style & DWT.READ_ONLY) !is 0) return LRESULT.NULL;
-    if (!hooks (DWT.Verify) && !filters (DWT.Verify)) return LRESULT.NULL;
+    if ((style & DWT.READ_ONLY) !is 0) return null;
+    if (!hooks (DWT.Verify) && !filters (DWT.Verify)) return null;
     bool call = false;
     int start, end;
     char[] newText = null;
@@ -2361,7 +2361,7 @@
         ignoreVerify = ignoreCharacter = false;
         return LRESULT.ONE;
     }
-    return LRESULT.NULL;
+    return null;
 }
 
 override LRESULT wmColorChild (int wParam, int lParam) {
@@ -2378,7 +2378,7 @@
                                 OS.SetTextColor (cast(HANDLE) wParam, getForegroundPixel ());
                                 OS.SetBkColor (cast(HANDLE) wParam, getBackgroundPixel ());
                                 OS.SetBkMode (cast(HANDLE) wParam, OS.TRANSPARENT);
-                                return cast(LRESULT) (OS.GetStockObject (OS.NULL_BRUSH));
+                                return new LRESULT ( cast(int) OS.GetStockObject (OS.NULL_BRUSH));
                             }
                         }
                     }
--- a/dwt/widgets/ToolBar.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/widgets/ToolBar.d	Mon Feb 11 02:44:32 2008 +0100
@@ -167,8 +167,8 @@
     }
 }
 
-override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
-    if (handle is null) return LRESULT.ZERO;
+override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
+    if (handle is null) return 0;
     /*
     * Bug in Windows.  For some reason, during the processing
     * of WM_SYSCHAR, the tool bar window proc does not call the
@@ -177,9 +177,9 @@
     * window proc for WM_SYSCHAR.
     */
     if (msg is OS.WM_SYSCHAR) {
-        return cast(LRESULT) OS.DefWindowProc (hwnd, msg, wParam, lParam);
+        return OS.DefWindowProc (hwnd, msg, wParam, lParam);
     }
-    return cast(LRESULT) OS.CallWindowProc (ToolBarProc, hwnd, msg, wParam, lParam);
+    return OS.CallWindowProc (ToolBarProc, hwnd, msg, wParam, lParam);
 }
 
 static int checkStyle (int style) {
@@ -1053,7 +1053,7 @@
 
 override LRESULT WM_CAPTURECHANGED (int wParam, int lParam) {
     LRESULT result = super.WM_CAPTURECHANGED (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Bug in Windows.  When the tool bar loses capture while an
     * item is pressed, the item remains pressed.  The fix is
@@ -1074,7 +1074,7 @@
 
 override LRESULT WM_CHAR (int wParam, int lParam) {
     LRESULT result = super.WM_CHAR (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     switch (wParam) {
         case ' ':
             int index = OS.SendMessage (handle, OS.TB_GETHOTITEM, 0, 0);
@@ -1111,7 +1111,7 @@
     * for this control.
     */
     LRESULT result = super.WM_COMMAND (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     return LRESULT.ZERO;
 }
 
@@ -1139,13 +1139,13 @@
     * processed without needing to press the ALT key
     * when the widget has focus.
     */
-    if (result !is LRESULT.NULL) return result;
-    return cast(LRESULT) (OS.DLGC_BUTTON);
+    if (result !is null) return result;
+    return new LRESULT (OS.DLGC_BUTTON);
 }
 
 override LRESULT WM_KEYDOWN (int wParam, int lParam) {
     LRESULT result = super.WM_KEYDOWN (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     switch (wParam) {
         case OS.VK_SPACE:
             /*
@@ -1168,18 +1168,18 @@
 }
 
 override LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
-    if (ignoreMouse) return LRESULT.NULL;
+    if (ignoreMouse) return null;
     return super.WM_LBUTTONDOWN (wParam, lParam);
 }
 
 override LRESULT WM_LBUTTONUP (int wParam, int lParam) {
-    if (ignoreMouse) return LRESULT.NULL;
+    if (ignoreMouse) return null;
     return super.WM_LBUTTONUP (wParam, lParam);
 }
 
 override LRESULT WM_MOUSELEAVE (int wParam, int lParam) {
     LRESULT result = super.WM_MOUSELEAVE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Bug in Windows.  On XP, when a tooltip is
     * hidden due to a time out or mouse press,
@@ -1225,7 +1225,7 @@
     * for this control.
     */
     LRESULT result = super.WM_NOTIFY (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     return LRESULT.ZERO;
 }
 
@@ -1242,7 +1242,7 @@
     if (ignoreResize) {
         int code = callWindowProc (handle, OS.WM_SIZE, wParam, lParam);
         if (code is 0) return LRESULT.ZERO;
-        return cast(LRESULT) (code);
+        return new LRESULT (code);
     }
     LRESULT result = super.WM_SIZE (wParam, lParam);
     if (isDisposed ()) return result;
@@ -1282,7 +1282,7 @@
 
 override LRESULT WM_WINDOWPOSCHANGING (int wParam, int lParam) {
     LRESULT result = super.WM_WINDOWPOSCHANGING (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     if (ignoreResize) return result;
     /*
     * Bug in Windows.  When a flat tool bar is wrapped,
@@ -1324,7 +1324,7 @@
 
 override LRESULT wmCommandChild (int wParam, int lParam) {
     ToolItem child = items [wParam & 0xFFFF];
-    if (child is null) return LRESULT.NULL;
+    if (child is null) return null;
     return child.wmCommandChild (wParam, lParam);
 }
 
@@ -1373,7 +1373,7 @@
                         OS.SetRect (&rect, nmcd.rc.left, nmcd.rc.top, nmcd.rc.right, nmcd.rc.bottom);
                         drawBackground (nmcd.hdc, &rect);
                     }
-                    return cast(LRESULT) (OS.CDRF_SKIPDEFAULT);
+                    return new LRESULT (OS.CDRF_SKIPDEFAULT);
                 }
                 default:
             }
--- a/dwt/widgets/ToolItem.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/widgets/ToolItem.d	Mon Feb 11 02:44:32 2008 +0100
@@ -964,7 +964,7 @@
         }
     }
     postEvent (DWT.Selection);
-    return LRESULT.NULL;
+    return null;
 }
 
 }
--- a/dwt/widgets/Tracker.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/widgets/Tracker.d	Mon Feb 11 02:44:32 2008 +0100
@@ -922,7 +922,7 @@
 
 override LRESULT wmKeyDown (HWND hwnd, int wParam, int lParam) {
     LRESULT result = super.wmKeyDown (hwnd, wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     bool isMirrored = parent !is null && (parent.style & DWT.MIRRORED) !is 0;
     int stepSize = OS.GetKeyState (OS.VK_CONTROL) < 0 ? STEPSIZE_SMALL : STEPSIZE_LARGE;
     int xChange = 0, yChange = 0;
@@ -1057,7 +1057,7 @@
 
 override LRESULT wmSysKeyDown (HWND hwnd, int wParam, int lParam) {
     LRESULT result = super.wmSysKeyDown (hwnd, wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     cancelled = true;
     tracking = false;
     return result;
@@ -1182,7 +1182,7 @@
         oldY = newY;
     }
     tracking = message !is OS.WM_LBUTTONUP;
-    return LRESULT.NULL;
+    return null;
 }
 
 }
--- a/dwt/widgets/Tree.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/widgets/Tree.d	Mon Feb 11 02:44:32 2008 +0100
@@ -371,8 +371,8 @@
 }
 
 LRESULT CDDS_ITEMPOSTPAINT (NMTVCUSTOMDRAW* nmcd, int wParam, int lParam) {
-    if (ignoreCustomDraw) return LRESULT.NULL;
-    if (nmcd.nmcd.rc.left is nmcd.nmcd.rc.right) return cast(LRESULT) (OS.CDRF_DODEFAULT);
+    if (ignoreCustomDraw) return null;
+    if (nmcd.nmcd.rc.left is nmcd.nmcd.rc.right) return new LRESULT (OS.CDRF_DODEFAULT);
     auto hDC = nmcd.nmcd.hdc;
     OS.RestoreDC (hDC, -1);
     TreeItem item = getItem (nmcd);
@@ -387,7 +387,7 @@
     * NOTE: This only happens on XP with the version 6.00 of
     * COMCTL32.DLL,
     */
-    if (item is null) return LRESULT.NULL;
+    if (item is null) return null;
 
     /*
     * Feature in Windows.  Under certain circumstances, Windows
@@ -400,8 +400,8 @@
     * and LPSTR_TEXTCALLBACK are used at the same time with
     * TVM_SETITEM.
     */
-    if (nmcd.nmcd.rc.left >= nmcd.nmcd.rc.right || nmcd.nmcd.rc.top >= nmcd.nmcd.rc.bottom) return LRESULT.NULL;
-    if (!OS.IsWindowVisible (handle)) return LRESULT.NULL;
+    if (nmcd.nmcd.rc.left >= nmcd.nmcd.rc.right || nmcd.nmcd.rc.top >= nmcd.nmcd.rc.bottom) return null;
+    if (!OS.IsWindowVisible (handle)) return null;
     if ((style & DWT.FULL_SELECTION) !is 0 || findImageControl () !is null || ignoreDrawSelection || explorerTheme) {
         OS.SetBkMode (hDC, OS.TRANSPARENT);
     }
@@ -967,7 +967,7 @@
             }
         }
     }
-    return cast(LRESULT) (OS.CDRF_DODEFAULT);
+    return new LRESULT (OS.CDRF_DODEFAULT);
 }
 
 LRESULT CDDS_ITEMPREPAINT (NMTVCUSTOMDRAW* nmcd, int wParam, int lParam) {
@@ -987,14 +987,14 @@
     * NOTE: This only happens on XP with the version 6.00 of
     * COMCTL32.DLL,
     */
-    if (item is null) return LRESULT.NULL;
+    if (item is null) return null;
     auto hDC = nmcd.nmcd.hdc;
     int index = hwndHeader !is null ? OS.SendMessage (hwndHeader, OS.HDM_ORDERTOINDEX, 0, 0) : 0;
     HFONT hFont = item.cellFont !is null ? item.cellFont [index] : cast(HFONT)-1;
     if (hFont is cast(HFONT)-1) hFont = item.font;
     if (hFont !is cast(HFONT)-1) OS.SelectObject (hDC, hFont);
     if (ignoreCustomDraw || nmcd.nmcd.rc.left is nmcd.nmcd.rc.right) {
-        return cast(LRESULT) (hFont is cast(HFONT)-1 ? OS.CDRF_DODEFAULT : OS.CDRF_NEWFONT);
+        return new LRESULT (hFont is cast(HFONT)-1 ? OS.CDRF_DODEFAULT : OS.CDRF_NEWFONT);
     }
     int count = 0;
     RECT* clipRect = null;
@@ -1061,7 +1061,7 @@
             event.gc = null;
             gc.dispose ();
             OS.RestoreDC (hDC, nSavedDC);
-            if (isDisposed () || item.isDisposed ()) return LRESULT.NULL;
+            if (isDisposed () || item.isDisposed ()) return null;
             if (hwndHeader !is null) {
                 if (count is 0) {
                     if (event.x + event.width > scrollWidth) {
@@ -1129,7 +1129,7 @@
             int newTextClr = data.foreground;
             gc.dispose ();
             OS.RestoreDC (hDC, nSavedDC);
-            if (isDisposed () || item.isDisposed ()) return LRESULT.NULL;
+            if (isDisposed () || item.isDisposed ()) return null;
             if (event.doit) {
                 ignoreDrawForeground = (event.detail & DWT.FOREGROUND) is 0;
                 ignoreDrawBackground = (event.detail & DWT.BACKGROUND) is 0;
@@ -1221,7 +1221,7 @@
                 OS.IntersectClipRect (hDC, clipRect.left, clipRect.top, clipRect.right, clipRect.bottom);
             }
             OS.ExcludeClipRect (hDC, itemRect.left, itemRect.top, itemRect.right, itemRect.bottom);
-            return cast(LRESULT) (OS.CDRF_DODEFAULT | OS.CDRF_NOTIFYPOSTPAINT);
+            return new LRESULT (OS.CDRF_DODEFAULT | OS.CDRF_NOTIFYPOSTPAINT);
         }
         /*
         * Feature in Windows.  When the tree has the style
@@ -1245,11 +1245,11 @@
             }
         }
     }
-    LRESULT result = LRESULT.NULL;
+    LRESULT result = null;
     if (clrText is -1 && clrTextBk is -1 && hFont is cast(HFONT)-1) {
-        result = cast(LRESULT) (OS.CDRF_DODEFAULT | OS.CDRF_NOTIFYPOSTPAINT);
+        result = new LRESULT (OS.CDRF_DODEFAULT | OS.CDRF_NOTIFYPOSTPAINT);
     } else {
-        result = cast(LRESULT) (OS.CDRF_NEWFONT | OS.CDRF_NOTIFYPOSTPAINT);
+        result = new LRESULT (OS.CDRF_NEWFONT | OS.CDRF_NOTIFYPOSTPAINT);
         if (hFont !is cast(HFONT)-1) OS.SelectObject (hDC, hFont);
         if (OS.IsWindowEnabled (handle) && OS.IsWindowVisible (handle)) {
             /*
@@ -1374,7 +1374,7 @@
 }
 
 LRESULT CDDS_POSTPAINT (NMTVCUSTOMDRAW* nmcd, int wParam, int lParam) {
-    if (ignoreCustomDraw) return LRESULT.NULL;
+    if (ignoreCustomDraw) return null;
     if (OS.IsWindowVisible (handle)) {
         if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
             if (sortColumn !is null && sortDirection !is DWT.NONE) {
@@ -1481,7 +1481,7 @@
             }
         }
     }
-    return cast(LRESULT) (OS.CDRF_DODEFAULT);
+    return new LRESULT (OS.CDRF_DODEFAULT);
 }
 
 LRESULT CDDS_PREPAINT (NMTVCUSTOMDRAW* nmcd, int wParam, int lParam) {
@@ -1492,16 +1492,16 @@
             drawBackground (nmcd.nmcd.hdc, &rect);
         }
     }
-    return cast(LRESULT) (OS.CDRF_NOTIFYITEMDRAW | OS.CDRF_NOTIFYPOSTPAINT);
-}
-
-override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
-    if (handle is null) return LRESULT.NULL;
+    return new LRESULT (OS.CDRF_NOTIFYITEMDRAW | OS.CDRF_NOTIFYPOSTPAINT);
+}
+
+override int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
+    if (handle is null) return 0;
     if (hwndParent !is null && hwnd is hwndParent) {
-        return cast(LRESULT) OS.DefWindowProc (hwnd, msg, wParam, lParam);
+        return OS.DefWindowProc (hwnd, msg, wParam, lParam);
     }
     if (hwndHeader !is null && hwnd is hwndHeader) {
-        return cast(LRESULT) OS.CallWindowProc (HeaderProc, hwnd, msg, wParam, lParam);
+        return OS.CallWindowProc (HeaderProc, hwnd, msg, wParam, lParam);
     }
     switch (msg) {
         case OS.WM_SETFOCUS: {
@@ -1655,7 +1655,7 @@
             break;
         default:
     }
-    return cast(LRESULT) code;
+    return code;
 }
 
 override void checkBuffered () {
@@ -5380,12 +5380,12 @@
             }
             case OS.WM_NCPAINT: {
                 LRESULT result = wmNCPaint (hwnd, wParam, lParam);
-                if (result !is LRESULT.NULL) return result;
+                if (result !is null) return result.value;
                 break;
             }
             case OS.WM_PRINT: {
                 LRESULT result = wmPrint (hwnd, wParam, lParam);
-                if (result !is LRESULT.NULL) return result;
+                if (result !is null) return result.value;
                 break;
             }
             case OS.WM_COMMAND:
@@ -5429,7 +5429,7 @@
                 int code = OS.SendMessage (handle, OS.WM_VSCROLL, wParam, lParam);
                 OS.GetScrollInfo (handle, OS.SB_VERT, &info);
                 OS.SetScrollInfo (hwndParent, OS.SB_VERT, &info, true);
-                return cast(LRESULT)code;
+                return code;
             }
             default:
         }
@@ -5440,7 +5440,7 @@
 
 override LRESULT WM_CHAR (int wParam, int lParam) {
     LRESULT result = super.WM_CHAR (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Feature in Windows.  The tree control beeps
     * in WM_CHAR when the search for the item that
@@ -5547,7 +5547,7 @@
 
 override LRESULT WM_KEYDOWN (int wParam, int lParam) {
     LRESULT result = super.WM_KEYDOWN (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     switch (wParam) {
         case OS.VK_SPACE:
             /*
@@ -5624,7 +5624,7 @@
                     Event event = new Event ();
                     event.item = _getItem (hNewItem, tvItem.lParam);
                     postEvent (DWT.Selection, event);
-                    return cast(LRESULT) (code);
+                    return new LRESULT (code);
                 }
             }
             if (OS.GetKeyState (OS.VK_CONTROL) < 0) {
@@ -5718,7 +5718,7 @@
             }
             int code = callWindowProc (handle, OS.WM_KEYDOWN, wParam, lParam);
             hAnchor = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
-            return cast(LRESULT) (code);
+            return new LRESULT (code);
         }
         default:
     }
@@ -5878,7 +5878,7 @@
             event.item = _getItem (lpht.hItem);
             postEvent (DWT.Selection, event);
         }
-        return cast(LRESULT) (code);
+        return new LRESULT (code);
     }
 
     /* Look for check/uncheck */
@@ -5939,7 +5939,7 @@
             if (!display.captureChanged && !isDisposed ()) {
                 if (OS.GetCapture () !is handle) OS.SetCapture (handle);
             }
-            return cast(LRESULT) (code);
+            return new LRESULT (code);
         }
     }
 
@@ -6172,13 +6172,13 @@
         }
     }
     dragStarted = false;
-    return cast(LRESULT) (code);
+    return new LRESULT (code);
 }
 
 override LRESULT WM_MOUSEMOVE (int wParam, int lParam) {
     Display display = this.display;
     LRESULT result = super.WM_MOUSEMOVE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     if (itemToolTipHandle !is null && hwndHeader !is null) {
         /*
         * Bug in Windows.  On some machines that do not have XBUTTONs,
@@ -6242,7 +6242,7 @@
 }
 
 override LRESULT WM_MOVE (int wParam, int lParam) {
-    if (ignoreResize) return LRESULT.NULL;
+    if (ignoreResize) return null;
     return super.WM_MOVE (wParam, lParam);
 }
 
@@ -6390,7 +6390,7 @@
 
 override LRESULT WM_PRINTCLIENT (int wParam, int lParam) {
     LRESULT result = super.WM_PRINTCLIENT (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Feature in Windows.  For some reason, when WM_PRINT is used
     * to capture an image of a hierarchy that contains a tree with
@@ -6404,7 +6404,7 @@
     printClient = true;
     int code = callWindowProc (handle, OS.WM_PRINTCLIENT, wParam, lParam);
     printClient = false;
-    return cast(LRESULT) (code);
+    return new LRESULT (code);
 }
 
 override LRESULT WM_SETFOCUS (int wParam, int lParam) {
@@ -6439,7 +6439,7 @@
 
 override LRESULT WM_SETFONT (int wParam, int lParam) {
     LRESULT result = super.WM_SETFONT (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     if (hwndHeader !is null) {
         /*
         * Bug in Windows.  When a header has a sort indicator
@@ -6462,7 +6462,7 @@
 
 override LRESULT WM_SETREDRAW (int wParam, int lParam) {
     LRESULT result = super.WM_SETREDRAW (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Bug in Windows.  Under certain circumstances, when
     * WM_SETREDRAW is used to turn off drawing and then
@@ -6476,7 +6476,7 @@
     */
     if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
         int code = OS.DefWindowProc (handle, OS.WM_SETREDRAW, wParam, lParam);
-        return code is 0 ? LRESULT.ZERO : cast(LRESULT) (code);
+        return code is 0 ? LRESULT.ZERO : new LRESULT (code);
     }
     return result;
 }
@@ -6506,13 +6506,13 @@
             }
         }
     }
-    if (ignoreResize) return LRESULT.NULL;
+    if (ignoreResize) return null;
     return super.WM_SIZE (wParam, lParam);
 }
 
 override LRESULT WM_SYSCOLORCHANGE (int wParam, int lParam) {
     LRESULT result = super.WM_SYSCOLORCHANGE (wParam, lParam);
-    if (result !is LRESULT.NULL) return result;
+    if (result !is null) return result;
     /*
     * Bug in Windows.  When the tree is using the explorer
     * theme, it does not use COLOR_WINDOW_TEXT for the
@@ -6531,7 +6531,7 @@
         if (OS.COMCTL32_MAJOR < 6) {
             return super.wmColorChild (wParam, lParam);
         }
-        return cast(LRESULT) (OS.GetStockObject (OS.NULL_BRUSH));
+        return new LRESULT ( cast(int) OS.GetStockObject (OS.NULL_BRUSH));
     }
     /*
     * Feature in Windows.  Tree controls send WM_CTLCOLOREDIT
@@ -6540,7 +6540,7 @@
     * and TVM_SETBKCOLOR, the documented way to do this.  The
     * fix is to ignore WM_CTLCOLOREDIT messages from trees.
     */
-    return LRESULT.NULL;
+    return null;
 }
 
 override LRESULT wmNotify (NMHDR* hdr, int wParam, int lParam) {
@@ -6572,7 +6572,7 @@
                         auto hDC = OS.GetDC (handle);
                         HFONT oldFont, newFont = cast(HFONT) OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
                         if (newFont !is null) oldFont = OS.SelectObject (hDC, newFont);
-                        LRESULT result = LRESULT.NULL;
+                        LRESULT result = null;
                         RECT rect;
                         OS.GetClientRect (hwndParent, &rect);
                         OS.MapWindowPoints (hwndParent, handle, cast(POINT*) &rect, 2);
@@ -6602,7 +6602,7 @@
                         }
                         if (newFont !is null) OS.SelectObject (hDC, oldFont);
                         OS.ReleaseDC (handle, hDC);
-                        if (result !is LRESULT.NULL) return result;
+                        if (result !is null) return result;
                     }
                 }
                 default:
--- a/dwt/widgets/Widget.d	Mon Feb 11 00:56:33 2008 +0100
+++ b/dwt/widgets/Widget.d	Mon Feb 11 02:44:32 2008 +0100
@@ -32,7 +32,7 @@
 import dwt.dwthelper.utils;
 import tango.util.log.Trace;
 void trc( long line ){
-    //Trace.formatln( "Widget {}", line );
+//    Trace.formatln( "Widget {}", line );
 }
 
 /**
@@ -64,18 +64,13 @@
 
 public abstract class Widget {
 
-    public enum LRESULT {
-        NULL = -1,
-        ZERO = 0,
-        ONE = 1,
-    }
-
-
     int style, state;
     Display display;
     EventTable eventTable;
     Object data;
 
+    public alias dwt.internal.win32.OS.LDWTRESULT LRESULT;
+
     /* Global state flags */
     static const int DISPOSED       = 1<<0;
     static const int CANVAS         = 1<<1;
@@ -237,8 +232,8 @@
     addListener (DWT.Dispose, typedListener);
 }
 
-LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
-    return LRESULT.ZERO;
+int callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
+    return 0;
 }
 
 /**
@@ -1312,7 +1307,7 @@
 
 LRESULT wmCaptureChanged (HWND hwnd, int wParam, int lParam) {
     display.captureChanged = true;
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT wmChar (HWND hwnd, int wParam, int lParam) {
@@ -1321,7 +1316,7 @@
     */
     if (!OS.IsUnicode && OS.IsDBLocale) {
         byte lead = cast(byte) (wParam & 0xFF);
-        if (OS.IsDBCSLeadByte (lead)) return LRESULT.NULL;
+        if (OS.IsDBCSLeadByte (lead)) return null;
     }
     display.lastAscii = wParam;
     display.lastNull = wParam is 0;
@@ -1329,11 +1324,11 @@
         return LRESULT.ONE;
     }
     // widget could be disposed at this point
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT wmContextMenu (HWND hwnd, int wParam, int lParam) {
-    if (wParam !is cast(int)hwnd) return LRESULT.NULL;
+    if (wParam !is cast(int)hwnd) return null;
 
     /*
     * Feature in Windows.  SHRecognizeGesture() sends an undocumented
@@ -1346,7 +1341,7 @@
     * NOTE: This only happens on WM2003.  Previous WinCE versions did
     * not support WM_CONTEXTMENU.
     */
-    if (OS.IsWinCE) return LRESULT.NULL;
+    if (OS.IsWinCE) return null;
 
     /*
     * Feature in Windows.  When the user presses  WM_NCRBUTTONUP,
@@ -1367,7 +1362,7 @@
         OS.ScreenToClient (hwnd, &pt);
         RECT rect;
         OS.GetClientRect (hwnd, &rect);
-        if (!OS.PtInRect (&rect, pt)) return LRESULT.NULL;
+        if (!OS.PtInRect (&rect, pt)) return null;
     } else {
         int pos = OS.GetMessagePos ();
         x = cast(short) (pos & 0xFFFF);
@@ -1375,7 +1370,7 @@
     }
 
     /* Show the menu */
-    return showMenu (x, y) ? LRESULT.ZERO : LRESULT.NULL;
+    return showMenu (x, y) ? LRESULT.ZERO : null;
 }
 
 LRESULT wmIMEChar (HWND hwnd, int wParam, int lParam) {
@@ -1402,7 +1397,7 @@
         case OS.VK_CAPITAL:
         case OS.VK_NUMLOCK:
         case OS.VK_SCROLL:
-            if ((lParam & 0x40000000) !is 0) return LRESULT.NULL;
+            if ((lParam & 0x40000000) !is 0) return null;
         default:
     }
 
@@ -1415,7 +1410,7 @@
     */
     if (!OS.IsUnicode && OS.IsDBLocale) {
         byte lead = cast(byte) (wParam & 0xFF);
-        if (OS.IsDBCSLeadByte (lead)) return LRESULT.NULL;
+        if (OS.IsDBCSLeadByte (lead)) return null;
     }
 
     /* Map the virtual key */
@@ -1460,9 +1455,9 @@
     * and avoid issuing the event.
     */
     if (OS.IsWinNT) {
-        if ((mapKey & 0x80000000) !is 0) return LRESULT.NULL;
+        if ((mapKey & 0x80000000) !is 0) return null;
     } else {
-        if ((mapKey & 0x8000) !is 0) return LRESULT.NULL;
+        if ((mapKey & 0x8000) !is 0) return null;
     }
     MSG msg;
     int flags = OS.PM_NOREMOVE | OS.PM_NOYIELD | OS.PM_QS_INPUT | OS.PM_QS_POSTMESSAGE;
@@ -1470,7 +1465,7 @@
         display.lastDead = true;
         display.lastVirtual = mapKey is 0;
         display.lastKey = display.lastVirtual ? wParam : mapKey;
-        return LRESULT.NULL;
+        return null;
     }
 
     /*
@@ -1536,7 +1531,7 @@
             * special Windows keypad sequence when NumLock is down (ie. typing
             * ALT+0231 should gives 'c' with a cedilla when NumLock is down).
             */
-            if (display.asciiKey (display.lastKey) !is 0) return LRESULT.NULL;
+            if (display.asciiKey (display.lastKey) !is 0) return null;
             display.lastAscii = display.numpadKey (display.lastKey);
         }
     } else {
@@ -1574,8 +1569,8 @@
             * To avoid the extra DWT.KeyDown, look for a space and
             * issue the event from WM_CHAR.
             */
-            if (asciiKey is ' ') return LRESULT.NULL;
-            if (asciiKey !is wParam) return LRESULT.NULL;
+            if (asciiKey is ' ') return null;
+            if (asciiKey !is wParam) return null;
             /*
             * Feature in Windows. The virtual key VK_CANCEL is treated
             * as both a virtual key and ASCII key by Windows.  This
@@ -1583,7 +1578,7 @@
             * this key. To avoid the extra DWT.KeyDown, look for
             * VK_CANCEL and issue the event from WM_CHAR.
             */
-            if (wParam is OS.VK_CANCEL) return LRESULT.NULL;
+            if (wParam is OS.VK_CANCEL) return null;
         }
 
         /*
@@ -1592,7 +1587,7 @@
         * key such as 'A' or Shift+A.  In that case, issue the
         * key event from WM_CHAR.
         */
-        if (OS.GetKeyState (OS.VK_CONTROL) >= 0) return LRESULT.NULL;
+        if (OS.GetKeyState (OS.VK_CONTROL) >= 0) return null;
 
         /*
         * Get the shifted state or convert to lower case if necessary.
@@ -1609,14 +1604,14 @@
         }
 
         /* Note that Ctrl+'@' is ASCII NUL and is delivered in WM_CHAR */
-        if (display.lastAscii is '@') return LRESULT.NULL;
+        if (display.lastAscii is '@') return null;
         display.lastAscii = display.controlKey (display.lastAscii);
     }
     if (!sendKeyEvent (DWT.KeyDown, OS.WM_KEYDOWN, wParam, lParam)) {
         return LRESULT.ONE;
     }
     // widget could be disposed at this point
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT wmKeyUp (HWND hwnd, int wParam, int lParam) {
@@ -1633,7 +1628,7 @@
             int type = (lParam & 0x40000000) !is 0 ? DWT.HardKeyUp : DWT.HardKeyDown;
             if (setInputState (event, type)) sendEvent (type, event);
             // widget could be disposed at this point
-            return LRESULT.NULL;
+            return null;
         }
     }
 
@@ -1644,7 +1639,7 @@
     if (!hooks (DWT.KeyUp) && !display.filters (DWT.KeyUp)) {
         display.lastKey = display.lastAscii = 0;
         display.lastVirtual = display.lastNull = display.lastDead = false;
-        return LRESULT.NULL;
+        return null;
     }
 
     /* Map the virtual key. */
@@ -1682,11 +1677,11 @@
     * They should both be bit 32.
     */
     if (OS.IsWinNT) {
-        if ((mapKey & 0x80000000) !is 0) return LRESULT.NULL;
+        if ((mapKey & 0x80000000) !is 0) return null;
     } else {
-        if ((mapKey & 0x8000) !is 0) return LRESULT.NULL;
+        if ((mapKey & 0x8000) !is 0) return null;
     }
-    if (display.lastDead) return LRESULT.NULL;
+    if (display.lastDead) return null;
 
     /*
     * NOTE: On Windows 98, keypad keys are virtual despite the
@@ -1709,10 +1704,10 @@
         if (display.lastKey is 0) {
             display.lastAscii = 0;
             display.lastNull = display.lastDead = false;
-            return LRESULT.NULL;
+            return null;
         }
     }
-    LRESULT result = LRESULT.NULL;
+    LRESULT result = null;
     if (!sendKeyEvent (DWT.KeyUp, OS.WM_KEYUP, wParam, lParam)) {
         result = LRESULT.ONE;
     }
@@ -1723,8 +1718,7 @@
 }
 
 LRESULT wmKillFocus (HWND hwnd, int wParam, int lParam) {
-    LRESULT code = callWindowProc (hwnd, OS.WM_KILLFOCUS, wParam, lParam);
-    assert( code !is LRESULT.NULL );
+    int code = callWindowProc (hwnd, OS.WM_KILLFOCUS, wParam, lParam);
     sendFocusEvent (DWT.FocusOut);
     // widget could be disposed at this point
 
@@ -1737,7 +1731,7 @@
     */
     if (isDisposed ()) return LRESULT.ZERO;
     if (code is 0) return LRESULT.ZERO;
-    return cast(LRESULT) code;
+    return new LRESULT(code);
 }
 
 LRESULT wmLButtonDblClk (HWND hwnd, int wParam, int lParam) {
@@ -1754,13 +1748,12 @@
     * pairs will not see the second mouse down.  The
     * fix is to send a mouse down event.
     */
-    LRESULT result = LRESULT.NULL;
+    LRESULT result = null;
     Display display = this.display;
     display.captureChanged = false;
     sendMouseEvent (DWT.MouseDown, 1, hwnd, OS.WM_LBUTTONDOWN, wParam, lParam);
     if (sendMouseEvent (DWT.MouseDoubleClick, 1, hwnd, OS.WM_LBUTTONDBLCLK, wParam, lParam)) {
-        result = callWindowProc (hwnd, OS.WM_LBUTTONDBLCLK, wParam, lParam);
-        assert( result !is LRESULT.NULL );
+        result = new LRESULT( callWindowProc (hwnd, OS.WM_LBUTTONDBLCLK, wParam, lParam));
     } else {
         result = LRESULT.ZERO;
     }
@@ -1772,7 +1765,7 @@
 
 LRESULT wmLButtonDown (HWND hwnd, int wParam, int lParam) {
     Display display = this.display;
-    LRESULT result = LRESULT.NULL;
+    LRESULT result = null;
     int x = cast(short) (lParam & 0xFFFF);
     int y = cast(short) (lParam >> 16);
     bool [] consume = null, detect = null;
@@ -1798,8 +1791,7 @@
     display.captureChanged = false;
     bool dispatch = sendMouseEvent (DWT.MouseDown, 1, count, 0, false, hwnd, OS.WM_LBUTTONDOWN, wParam, lParam);
     if (dispatch && (consume is null || !consume [0])) {
-        result = callWindowProc (hwnd, OS.WM_LBUTTONDOWN, wParam, lParam);
-        assert( result !is LRESULT.NULL );
+        result = new LRESULT( callWindowProc (hwnd, OS.WM_LBUTTONDOWN, wParam, lParam));
     } else {
         result = LRESULT.ZERO;
     }
@@ -1863,10 +1855,11 @@
 
 LRESULT wmLButtonUp (HWND hwnd, int wParam, int lParam) {
     Display display = this.display;
-    LRESULT result = LRESULT.NULL;
+    LRESULT result = null;
+trc(__LINE__);
     if (sendMouseEvent (DWT.MouseUp, 1, hwnd, OS.WM_LBUTTONUP, wParam, lParam)) {
-        result = callWindowProc (hwnd, OS.WM_LBUTTONUP, wParam, lParam);
-        assert( result !is LRESULT.NULL );
+trc(__LINE__);
+        result = new LRESULT( callWindowProc (hwnd, OS.WM_LBUTTONUP, wParam, lParam));
     } else {
         result = LRESULT.ZERO;
     }
@@ -1881,6 +1874,7 @@
     if (((wParam & 0xFFFF) & mask) is 0) {
         if (OS.GetCapture () is hwnd) OS.ReleaseCapture ();
     }
+Trace.formatln( "result={}", result );
     return result;
 }
 
@@ -1898,13 +1892,12 @@
     * pairs will not see the second mouse down.  The
     * fix is to send a mouse down event.
     */
-    LRESULT result = LRESULT.NULL;
+    LRESULT result = null;
     Display display = this.display;
     display.captureChanged = false;
     sendMouseEvent (DWT.MouseDown, 2, hwnd, OS.WM_MBUTTONDOWN, wParam, lParam);
     if (sendMouseEvent (DWT.MouseDoubleClick, 2, hwnd, OS.WM_MBUTTONDBLCLK, wParam, lParam)) {
-        result = callWindowProc (hwnd, OS.WM_MBUTTONDBLCLK, wParam, lParam);
-        assert( result !is LRESULT.NULL );
+        result = new LRESULT( callWindowProc (hwnd, OS.WM_MBUTTONDBLCLK, wParam, lParam));
     } else {
         result = LRESULT.ZERO;
     }
@@ -1915,12 +1908,11 @@
 }
 
 LRESULT wmMButtonDown (HWND hwnd, int wParam, int lParam) {
-    LRESULT result = LRESULT.NULL;
+    LRESULT result = null;
     Display display = this.display;
     display.captureChanged = false;
     if (sendMouseEvent (DWT.MouseDown, 2, hwnd, OS.WM_MBUTTONDOWN, wParam, lParam)) {
-        result = callWindowProc (hwnd, OS.WM_MBUTTONDOWN, wParam, lParam);
-        assert( result !is LRESULT.NULL );
+        result = new LRESULT( callWindowProc (hwnd, OS.WM_MBUTTONDOWN, wParam, lParam));
     } else {
         result = LRESULT.ZERO;
     }
@@ -1932,10 +1924,9 @@
 
 LRESULT wmMButtonUp (HWND hwnd, int wParam, int lParam) {
     Display display = this.display;
-    LRESULT result = LRESULT.NULL;
+    LRESULT result = null;
     if (sendMouseEvent (DWT.MouseUp, 2, hwnd, OS.WM_MBUTTONUP, wParam, lParam)) {
-        result = callWindowProc (hwnd, OS.WM_MBUTTONUP, wParam, lParam);
-        assert( result !is LRESULT.NULL );
+        result = new LRESULT( callWindowProc (hwnd, OS.WM_MBUTTONUP, wParam, lParam));
     } else {
         result = LRESULT.ZERO;
     }
@@ -1957,11 +1948,11 @@
     if (!sendMouseEvent (DWT.MouseHover, 0, hwnd, OS.WM_MOUSEHOVER, wParam, lParam)) {
         return LRESULT.ZERO;
     }
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT wmMouseLeave (HWND hwnd, int wParam, int lParam) {
-    if (!hooks (DWT.MouseExit) && !filters (DWT.MouseExit)) return LRESULT.NULL;
+    if (!hooks (DWT.MouseExit) && !filters (DWT.MouseExit)) return null;
     int pos = OS.GetMessagePos ();
     POINT pt;
     pt.x = cast(short) (pos & 0xFFFF);
@@ -1971,11 +1962,11 @@
     if (!sendMouseEvent (DWT.MouseExit, 0, hwnd, OS.WM_MOUSELEAVE, wParam, lParam)) {
         return LRESULT.ZERO;
     }
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT wmMouseMove (HWND hwnd, int wParam, int lParam) {
-    LRESULT result = LRESULT.NULL;
+    LRESULT result = null;
     Display display = this.display;
     int pos = OS.GetMessagePos ();
     if (pos !is display.lastMouse || display.captureChanged) {
@@ -2027,7 +2018,7 @@
 }
 
 LRESULT wmMouseWheel (HWND hwnd, int wParam, int lParam) {
-    if (!hooks (DWT.MouseWheel) && !filters (DWT.MouseWheel)) return LRESULT.NULL;
+    if (!hooks (DWT.MouseWheel) && !filters (DWT.MouseWheel)) return null;
     int delta = wParam >> 16;
     int value;
     int count, detail;
@@ -2047,23 +2038,22 @@
     if (!sendMouseEvent (DWT.MouseWheel, 0, count, detail, true, hwnd, OS.WM_MOUSEWHEEL, wParam, lParam)) {
         return LRESULT.ZERO;
     }
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT wmPaint (HWND hwnd, int wParam, int lParam) {
 
     /* Exit early - don't draw the background */
     if (!hooks (DWT.Paint) && !filters (DWT.Paint)) {
-        return LRESULT.NULL;
+        return null;
     }
 
     /* Issue a paint event */
-    LRESULT result = LRESULT.NULL;
+    int result = 0;
     if (OS.IsWinCE) {
         RECT rect;
         OS.GetUpdateRect (hwnd, &rect, false);
         result = callWindowProc (hwnd, OS.WM_PAINT, wParam, lParam);
-        assert( result !is LRESULT.NULL );
         /*
         * Bug in Windows.  When InvalidateRgn(), InvalidateRect()
         * or RedrawWindow() with RDW_INVALIDATE is called from
@@ -2100,7 +2090,6 @@
         auto rgn = OS.CreateRectRgn (0, 0, 0, 0);
         OS.GetUpdateRgn (hwnd, rgn, false);
         result = callWindowProc (hwnd, OS.WM_PAINT, wParam, lParam);
-        assert( result !is LRESULT.NULL );
         GCData data = new GCData ();
         data.hwnd = hwnd;
         GC gc = new_GC (data);
@@ -2130,7 +2119,7 @@
         OS.DeleteObject (rgn);
     }
     if (result is 0) return LRESULT.ZERO;
-    return result;
+    return new LRESULT (result);
 }
 
 LRESULT wmPrint (HWND hwnd, int wParam, int lParam) {
@@ -2144,8 +2133,7 @@
         if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
             int bits = OS.GetWindowLong (hwnd, OS.GWL_EXSTYLE);
             if ((bits & OS.WS_EX_CLIENTEDGE) !is 0) {
-                LRESULT code = callWindowProc (hwnd, OS.WM_PRINT, wParam, lParam);
-                assert( code !is LRESULT.NULL );
+                int code = callWindowProc (hwnd, OS.WM_PRINT, wParam, lParam);
                 RECT rect;
                 OS.GetWindowRect (hwnd, &rect);
                 rect.right -= rect.left;
@@ -2154,11 +2142,11 @@
                 int border = OS.GetSystemMetrics (OS.SM_CXEDGE);
                 OS.ExcludeClipRect ( cast(void*)wParam, border, border, rect.right - border, rect.bottom - border);
                 OS.DrawThemeBackground (display.hEditTheme (), cast(HDC)wParam, OS.EP_EDITTEXT, OS.ETS_NORMAL, &rect, null);
-                return cast(LRESULT)code;
+                return new LRESULT (code);
             }
         }
     }
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT wmRButtonDblClk (HWND hwnd, int wParam, int lParam) {
@@ -2175,13 +2163,12 @@
     * pairs will not see the second mouse down.  The
     * fix is to send a mouse down event.
     */
-    LRESULT result = LRESULT.NULL;
+    LRESULT result = null;
     Display display = this.display;
     display.captureChanged = false;
     sendMouseEvent (DWT.MouseDown, 3, hwnd, OS.WM_RBUTTONDOWN, wParam, lParam);
     if (sendMouseEvent (DWT.MouseDoubleClick, 3, hwnd, OS.WM_RBUTTONDBLCLK, wParam, lParam)) {
-        result = callWindowProc (hwnd, OS.WM_RBUTTONDBLCLK, wParam, lParam);
-        assert( result !is LRESULT.NULL );
+        result = new LRESULT (callWindowProc (hwnd, OS.WM_RBUTTONDBLCLK, wParam, lParam));
     } else {
         result = LRESULT.ZERO;
     }
@@ -2192,12 +2179,11 @@
 }
 
 LRESULT wmRButtonDown (HWND hwnd, int wParam, int lParam) {
-    LRESULT result = LRESULT.NULL;
+    LRESULT result = null;
     Display display = this.display;
     display.captureChanged = false;
     if (sendMouseEvent (DWT.MouseDown, 3, hwnd, OS.WM_RBUTTONDOWN, wParam, lParam)) {
-        result = callWindowProc (hwnd, OS.WM_RBUTTONDOWN, wParam, lParam);
-        assert( result !is LRESULT.NULL );
+        result = new LRESULT (callWindowProc (hwnd, OS.WM_RBUTTONDOWN, wParam, lParam));
     } else {
         result = LRESULT.ZERO;
     }
@@ -2209,10 +2195,9 @@
 
 LRESULT wmRButtonUp (HWND hwnd, int wParam, int lParam) {
     Display display = this.display;
-    LRESULT result = LRESULT.NULL;
+    LRESULT result = null;
     if (sendMouseEvent (DWT.MouseUp, 3, hwnd, OS.WM_RBUTTONUP, wParam, lParam)) {
-        result = callWindowProc (hwnd, OS.WM_RBUTTONUP, wParam, lParam);
-        assert( result !is LRESULT.NULL );
+        result = new LRESULT( callWindowProc (hwnd, OS.WM_RBUTTONUP, wParam, lParam));
     } else {
         /* Call the DefWindowProc() to support WM_CONTEXTMENU */
         OS.DefWindowProc (hwnd, OS.WM_RBUTTONUP, wParam, lParam);
@@ -2233,8 +2218,7 @@
 }
 
 LRESULT wmSetFocus (HWND hwnd, int wParam, int lParam) {
-    LRESULT code = callWindowProc (hwnd, OS.WM_SETFOCUS, wParam, lParam);
-    assert( code !is LRESULT.NULL );
+    int code = callWindowProc (hwnd, OS.WM_SETFOCUS, wParam, lParam);
     sendFocusEvent (DWT.FocusIn);
     // widget could be disposed at this point
 
@@ -2247,7 +2231,7 @@
     */
     if (isDisposed ()) return LRESULT.ZERO;
     if (code is 0) return LRESULT.ZERO;
-    return code;
+    return new LRESULT (code);
 }
 
 LRESULT wmSysChar (HWND hwnd, int wParam, int lParam) {
@@ -2257,14 +2241,13 @@
 
     /* Do not issue a key down if a menu bar mnemonic was invoked */
     if (!hooks (DWT.KeyDown) && !display.filters (DWT.KeyDown)) {
-        return LRESULT.NULL;
+        return null;
     }
 
     /* Call the window proc to determine whether it is a system key or mnemonic */
     bool oldKeyHit = display.mnemonicKeyHit;
     display.mnemonicKeyHit = true;
-    LRESULT result = callWindowProc (hwnd, OS.WM_SYSCHAR, wParam, lParam);
-    assert( result !is LRESULT.NULL );
+    int result = callWindowProc (hwnd, OS.WM_SYSCHAR, wParam, lParam);
     bool consumed = false;
     if (!display.mnemonicKeyHit) {
         consumed = !sendKeyEvent (DWT.KeyDown, OS.WM_SYSCHAR, wParam, lParam);
@@ -2272,7 +2255,7 @@
     }
     consumed |= display.mnemonicKeyHit;
     display.mnemonicKeyHit = oldKeyHit;
-    return consumed ? LRESULT.ONE : result;
+    return consumed ? LRESULT.ONE : new LRESULT (result);
 }
 
 LRESULT wmSysKeyDown (HWND hwnd, int wParam, int lParam) {
@@ -2286,7 +2269,7 @@
     */
     if (wParam !is OS.VK_F10) {
         /* Make sure WM_SYSKEYDOWN was sent by ALT-<aKey>. */
-        if ((lParam & 0x20000000) is 0) return LRESULT.NULL;
+        if ((lParam & 0x20000000) is 0) return null;
     }
 
     /* Ignore well known system keys */
@@ -2298,7 +2281,7 @@
                 hwndShell = OS.GetParent (hwndShell);
             }
             int bits = OS.GetWindowLong (hwndShell, OS.GWL_STYLE);
-            if ((bits & OS.WS_SYSMENU) !is 0) return LRESULT.NULL;
+            if ((bits & OS.WS_SYSMENU) !is 0) return null;
         }
         default:
     }
@@ -2311,7 +2294,7 @@
         case OS.VK_CAPITAL:
         case OS.VK_NUMLOCK:
         case OS.VK_SCROLL:
-            if ((lParam & 0x40000000) !is 0) return LRESULT.NULL;
+            if ((lParam & 0x40000000) !is 0) return null;
         default:
     }
 
@@ -2370,7 +2353,7 @@
                 case OS.VK_ADD:
                 case OS.VK_SUBTRACT:
                 case OS.VK_DECIMAL:
-                case OS.VK_DIVIDE: return LRESULT.NULL;
+                case OS.VK_DIVIDE: return null;
                 default:
             }
             display.lastAscii = display.numpadKey (display.lastKey);
@@ -2390,8 +2373,8 @@
         * this message never happens.  The fix is to issue the
         * event from WM_SYSKEYDOWN and map VK_RETURN to '\r'.
         */
-        if (OS.IsWinNT) return LRESULT.NULL;
-        if (wParam !is OS.VK_RETURN) return LRESULT.NULL;
+        if (OS.IsWinNT) return null;
+        if (wParam !is OS.VK_RETURN) return null;
         display.lastAscii = '\r';
     }
 
@@ -2399,7 +2382,7 @@
         return LRESULT.ONE;
     }
     // widget could be disposed at this point
-    return LRESULT.NULL;
+    return null;
 }
 
 LRESULT wmSysKeyUp (HWND hwnd, int wParam, int lParam) {
@@ -2420,14 +2403,13 @@
     * pairs will not see the second mouse down.  The
     * fix is to send a mouse down event.
     */
-    LRESULT result = LRESULT.NULL;
+    LRESULT result = null;
     Display display = this.display;
     display.captureChanged = false;
     int button = (wParam >> 16 is OS.XBUTTON1) ? 4 : 5;
     sendMouseEvent (DWT.MouseDown, button, hwnd, OS.WM_XBUTTONDOWN, wParam, lParam);
     if (sendMouseEvent (DWT.MouseDoubleClick, button, hwnd, OS.WM_XBUTTONDBLCLK, wParam, lParam)) {
-        result = callWindowProc (hwnd, OS.WM_XBUTTONDBLCLK, wParam, lParam);
-        assert( result !is LRESULT.NULL );
+        result = new LRESULT (callWindowProc (hwnd, OS.WM_XBUTTONDBLCLK, wParam, lParam));
     } else {
         result = LRESULT.ZERO;
     }
@@ -2438,14 +2420,13 @@
 }
 
 LRESULT wmXButtonDown (HWND hwnd, int wParam, int lParam) {
-    LRESULT result = LRESULT.NULL;
+    LRESULT result = null;
     Display display = this.display;
     display.captureChanged = false;
     display.xMouse = true;
     int button = (wParam >> 16 is OS.XBUTTON1) ? 4 : 5;
     if (sendMouseEvent (DWT.MouseDown, button, hwnd, OS.WM_XBUTTONDOWN, wParam, lParam)) {
-        result = callWindowProc (hwnd, OS.WM_XBUTTONDOWN, wParam, lParam);
-        assert( result !is LRESULT.NULL );
+        result = new LRESULT (callWindowProc (hwnd, OS.WM_XBUTTONDOWN, wParam, lParam));
     } else {
         result = LRESULT.ZERO;
     }
@@ -2457,11 +2438,10 @@
 
 LRESULT wmXButtonUp (HWND hwnd, int wParam, int lParam) {
     Display display = this.display;
-    LRESULT result = LRESULT.NULL;
+    LRESULT result = null;
     int button = (wParam >> 16 is OS.XBUTTON1) ? 4 : 5;
     if (sendMouseEvent (DWT.MouseUp, button, hwnd, OS.WM_XBUTTONUP, wParam, lParam)) {
-        result = callWindowProc (hwnd, OS.WM_XBUTTONUP, wParam, lParam);
-        assert( result !is LRESULT.NULL );
+        result = new LRESULT (callWindowProc (hwnd, OS.WM_XBUTTONUP, wParam, lParam));
     } else {
         result = LRESULT.ZERO;
     }