changeset 75:f824f1836871

Tree
author Frank Benoit <benoit@tionex.de>
date Tue, 05 Feb 2008 03:50:39 +0100
parents ecfb28edd2e1
children c390bd107089
files dwt/internal/win32/OS.d dwt/internal/win32/WINAPI.d dwt/internal/win32/WINTYPES.d dwt/widgets/Composite.d dwt/widgets/Control.d dwt/widgets/Display.d dwt/widgets/Tree.d dwt/widgets/TreeItem.d tango_sys_win32/Types.di
diffstat 9 files changed, 1343 insertions(+), 1295 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/internal/win32/OS.d	Tue Feb 05 00:15:31 2008 +0100
+++ b/dwt/internal/win32/OS.d	Tue Feb 05 03:50:39 2008 +0100
@@ -4363,6 +4363,7 @@
 alias WINAPI.InsertMenuW InsertMenuW;
 alias WINAPI.InterlockedDecrement InterlockedDecrement;
 alias WINAPI.InterlockedIncrement InterlockedIncrement;
+alias WINAPI.IntersectClipRect IntersectClipRect;
 alias WINAPI.IntersectRect IntersectRect;
 alias WINAPI.InvalidateRect InvalidateRect;
 alias WINAPI.InvalidateRgn InvalidateRgn;
--- a/dwt/internal/win32/WINAPI.d	Tue Feb 05 00:15:31 2008 +0100
+++ b/dwt/internal/win32/WINAPI.d	Tue Feb 05 03:50:39 2008 +0100
@@ -153,6 +153,13 @@
     LPCWSTR pszSubAppName,
     LPCWSTR pszSubIdList
 );
+int IntersectClipRect(
+  HDC hdc,         // handle to DC
+  int nLeftRect,   // x-coord of upper-left corner
+  int nTopRect,    // y-coord of upper-left corner
+  int nRightRect,  // x-coord of lower-right corner
+  int nBottomRect  // y-coord of lower-right corner
+);
 }
 //--------------------------------------------------------------------------------------
 
--- a/dwt/internal/win32/WINTYPES.d	Tue Feb 05 00:15:31 2008 +0100
+++ b/dwt/internal/win32/WINTYPES.d	Tue Feb 05 03:50:39 2008 +0100
@@ -70,6 +70,18 @@
     int idNew;
     DWORD dwFlags;
 }
+struct NMTVDISPINFO {
+    NMHDR hdr;
+    TVITEM item;
+}
+struct NMTVITEMCHANGE {
+    NMHDR hdr;
+    UINT uChanged;
+    HTREEITEM hItem;
+    UINT uStateNew;
+    UINT uStateOld;
+    LPARAM lParam;
+}
 // ....
 //--------------------------------------------------------------------------------
 
@@ -2081,6 +2093,16 @@
 }
 alias ULARGE_INTEGER * PULARGE_INTEGER;
 
+alias extern(Windows) int (*PFNTVCOMPARE)(LPARAM, LPARAM, LPARAM);
+struct TVSORTCB {
+    HTREEITEM hParent;
+    PFNTVCOMPARE lpfnCompare;
+    LPARAM lParam;
+}
+
+
+
+
 //struct WINDOWPLACEMENT {
 //    UINT length;
 //    UINT flags;
@@ -2090,15 +2112,15 @@
 //    RECT rcNormalPosition;
 //}
 //
-struct WINDOWPOS {
-    HWND hwnd;
-    HWND hwndInsertAfter;
-    int x;
-    int y;
-    int cx;
-    int cy;
-    UINT flags;
-}
+// struct WINDOWPOS {
+//     HWND hwnd;
+//     HWND hwndInsertAfter;
+//     int x;
+//     int y;
+//     int cx;
+//     int cy;
+//     UINT flags;
+// }
 
 // WNDCLASSA is declared in phobos
 // struct WNDCLASSW {
--- a/dwt/widgets/Composite.d	Tue Feb 05 00:15:31 2008 +0100
+++ b/dwt/widgets/Composite.d	Tue Feb 05 03:50:39 2008 +0100
@@ -742,10 +742,10 @@
 //              if ((bits & OS.WS_CLIPSIBLINGS) is 0) wp.flags |= OS.SWP_NOCOPYBITS;
 //          }
             if (defer) {
-                hdwp = DeferWindowPos (hdwp, wp.hwnd, null, wp.x, wp.y, wp.cx, wp.cy, wp.flags);
+                hdwp = DeferWindowPos (hdwp, wp._hwnd, null, wp.x, wp.y, wp.cx, wp.cy, wp.flags);
                 if (hdwp is null) return false;
             } else {
-                SetWindowPos (wp.hwnd, null, wp.x, wp.y, wp.cx, wp.cy, wp.flags);
+                SetWindowPos (wp._hwnd, null, wp.x, wp.y, wp.cx, wp.cy, wp.flags);
             }
         }
     }
--- a/dwt/widgets/Control.d	Tue Feb 05 00:15:31 2008 +0100
+++ b/dwt/widgets/Control.d	Tue Feb 05 03:50:39 2008 +0100
@@ -1012,7 +1012,7 @@
     if (lpwp is null) return;
     for (int i=0; i<lpwp.length; i++) {
         WINDOWPOS* wp = lpwp [i];
-        if (wp !is null && wp.hwnd is handle) {
+        if (wp !is null && wp._hwnd is handle) {
             /*
             * This code is intentionally commented.  All widgets that
             * are created by DWT have WS_CLIPSIBLINGS to ensure that
@@ -1023,7 +1023,7 @@
 //              int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
 //              if ((bits & OS.WS_CLIPSIBLINGS) is 0) wp.flags |= OS.SWP_NOCOPYBITS;
 //          }
-            SetWindowPos (wp.hwnd, null, wp.x, wp.y, wp.cx, wp.cy, wp.flags);
+            SetWindowPos (wp._hwnd, null, wp.x, wp.y, wp.cx, wp.cy, wp.flags);
             lpwp [i] = null;
             return;
         }
@@ -2572,7 +2572,7 @@
                 parent.lpwp = lpwp = newLpwp;
             }
             WINDOWPOS* wp = new WINDOWPOS;
-            wp.hwnd = topHandle_;
+            wp._hwnd = topHandle_;
             wp.x = x;
             wp.y = y;
             wp.cx = width;
--- a/dwt/widgets/Display.d	Tue Feb 05 00:15:31 2008 +0100
+++ b/dwt/widgets/Display.d	Tue Feb 05 03:50:39 2008 +0100
@@ -1273,7 +1273,7 @@
 public Widget findWidget (HANDLE handle, int id) {
     checkDevice ();
     Control control = getControl (handle);
-    return control !is null ? control.findItem (id) : null;
+    return control !is null ? control.findItem (cast(HANDLE) id) : null;
 }
 
 /**
--- a/dwt/widgets/Tree.d	Tue Feb 05 00:15:31 2008 +0100
+++ b/dwt/widgets/Tree.d	Tue Feb 05 03:50:39 2008 +0100
@@ -106,16 +106,18 @@
     TreeItem currentItem;
     TreeColumn sortColumn;
     HWND hwndParent, hwndHeader;
-    HANDLE hAnchor, hInsert, lastID, hSelect;
-    int hFirstIndexOf, hLastIndexOf, lastIndexOf, itemCount, sortDirection;
+    HANDLE hAnchor, hInsert, hSelect;
+    int lastID;
+    HANDLE hFirstIndexOf, hLastIndexOf;
+    int lastIndexOf, itemCount, sortDirection;
     bool dragStarted, gestureCompleted, insertAfter, shrink, ignoreShrink;
     bool ignoreSelect, ignoreExpand, ignoreDeselect, ignoreResize;
     bool lockSelection, oldSelected, newSelected, ignoreColumnMove;
     bool linesVisible, customDraw, printClient, painted, ignoreItemHeight;
     bool ignoreCustomDraw, ignoreDrawForeground, ignoreDrawBackground, ignoreDrawFocus;
     bool ignoreDrawSelection, ignoreDrawHot, ignoreFullSelection, explorerTheme;
-    int scrollWidth, itemToolTipHandle, selectionForeground;
-    HANDLE headerToolTipHandle;
+    int scrollWidth, selectionForeground;
+    HANDLE headerToolTipHandle, itemToolTipHandle;
     static const int INSET = 3;
     static const int GRID_WIDTH = 1;
     static const int SORT_WIDTH = 10;
@@ -124,18 +126,18 @@
     static const int INCREMENT = 5;
     static const int EXPLORER_EXTRA = 2;
     static const bool EXPLORER_THEME = true;
-    static const int TreeProc;
+    static const WNDPROC TreeProc;
     static const TCHAR[] TreeClass = OS.WC_TREEVIEW;
     static const WNDPROC HeaderProc;
     static const TCHAR[] HeaderClass = OS.WC_HEADER;
     static this() {
-        WNDCLASS lpWndClass = new WNDCLASS ();
-        OS.GetClassInfo (0, TreeClass, lpWndClass);
+        WNDCLASS lpWndClass;
+        OS.GetClassInfo (null, TreeClass.ptr, &lpWndClass);
         TreeProc = lpWndClass.lpfnWndProc;
-        OS.GetClassInfo (0, HeaderClass, lpWndClass);
+        OS.GetClassInfo (null, HeaderClass.ptr, &lpWndClass);
         HeaderProc = lpWndClass.lpfnWndProc;
     }
-
+    private static Tree sThis;
 /**
  * Constructs a new instance of this class given its parent
  * and a style value describing its behavior and appearance.
@@ -236,10 +238,10 @@
 }
 
 TreeItem _getItem (HANDLE hItem) {
-    TVITEM tvItem = new TVITEM ();
+    TVITEM tvItem;
     tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM;
     tvItem.hItem = hItem;
-    if (OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem) !is 0) {
+    if (OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem) !is 0) {
         return _getItem (tvItem.hItem, tvItem.lParam);
     }
     return null;
@@ -247,7 +249,7 @@
 
 TreeItem _getItem (HANDLE hItem, int id) {
     if ((style & DWT.VIRTUAL) is 0) return items [id];
-    return id !is -1 ? items [id] : new TreeItem (this, DWT.NONE, -1, -1, hItem);
+    return id !is -1 ? items [id] : new TreeItem (this, DWT.NONE, cast(HANDLE)-1, cast(HANDLE)-1, hItem);
 }
 
 void _setBackgroundPixel (int newPixel) {
@@ -351,13 +353,13 @@
 }
 
 override HWND borderHandle () {
-    return hwndParent !is 0 ? hwndParent : handle;
-}
-
-LRESULT CDDS_ITEMPOSTPAINT (NMTVCUSTOMDRAW nmcd, int wParam, int lParam) {
-    if (ignoreCustomDraw) return null;
-    if (nmcd.left is nmcd.right) return new LRESULT (OS.CDRF_DODEFAULT);
-    int hDC = nmcd.hdc;
+    return hwndParent !is null ? hwndParent : handle;
+}
+
+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);
+    auto hDC = nmcd.nmcd.hdc;
     OS.RestoreDC (hDC, -1);
     TreeItem item = getItem (nmcd);
 
@@ -371,7 +373,7 @@
     * NOTE: This only happens on XP with the version 6.00 of
     * COMCTL32.DLL,
     */
-    if (item is null) return null;
+    if (item is null) return LRESULT.NULL;
 
     /*
     * Feature in Windows.  Under certain circumstances, Windows
@@ -384,13 +386,13 @@
     * and LPSTR_TEXTCALLBACK are used at the same time with
     * TVM_SETITEM.
     */
-    if (nmcd.left >= nmcd.right || nmcd.top >= nmcd.bottom) return null;
-    if (!OS.IsWindowVisible (handle)) return null;
+    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 ((style & DWT.FULL_SELECTION) !is 0 || findImageControl () !is null || ignoreDrawSelection || explorerTheme) {
         OS.SetBkMode (hDC, OS.TRANSPARENT);
     }
     bool selected = isItemSelected (nmcd);
-    bool hot = explorerTheme && (nmcd.uItemState & OS.CDIS_HOT) !is 0;
+    bool hot = explorerTheme && (nmcd.nmcd.uItemState & OS.CDIS_HOT) !is 0;
     if (OS.IsWindowEnabled (handle)) {
         if (explorerTheme) {
             int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
@@ -405,14 +407,14 @@
     }
     int count = 0;
     int [] order = null;
-    RECT clientRect = new RECT ();
-    OS.GetClientRect (scrolledHandle (), clientRect);
-    if (hwndHeader !is 0) {
-        OS.MapWindowPoints (hwndParent, handle, clientRect, 2);
+    RECT clientRect;
+    OS.GetClientRect (scrolledHandle (), &clientRect);
+    if (hwndHeader !is null) {
+        OS.MapWindowPoints (hwndParent, handle, cast(POINT*) &clientRect, 2);
         count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
         if (count !is 0) {
             order = new int [count];
-            OS.SendMessage (hwndHeader, OS.HDM_GETORDERARRAY, count, order);
+            OS.SendMessage (hwndHeader, OS.HDM_GETORDERARRAY, count, cast(int) order.ptr);
         }
     }
     int sortIndex = -1, clrSortBk = -1;
@@ -427,11 +429,11 @@
     int x = 0;
     Point size = null;
     for (int i=0; i<Math.max (1, count); i++) {
-        int index = order is null ? i : order [i], width = nmcd.right - nmcd.left;
-        if (count > 0 && hwndHeader !is 0) {
-            HDITEM hdItem = new HDITEM ();
+        int index = order is null ? i : order [i], width = nmcd.nmcd.rc.right - nmcd.nmcd.rc.left;
+        if (count > 0 && hwndHeader !is null) {
+            HDITEM hdItem;
             hdItem.mask = OS.HDI_WIDTH;
-            OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, hdItem);
+            OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, &hdItem);
             width = hdItem.cxy;
         }
         if (i is 0) {
@@ -439,8 +441,8 @@
                 bool clear = !explorerTheme && !ignoreDrawSelection && findImageControl () is null;
                 if (clear || (selected && !ignoreDrawSelection) || (hot && !ignoreDrawHot)) {
                     bool draw = true;
-                    RECT pClipRect = new RECT ();
-                    OS.SetRect (pClipRect, width, nmcd.top, nmcd.right, nmcd.bottom);
+                    RECT pClipRect;
+                    OS.SetRect (&pClipRect, width, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom);
                     if (explorerTheme) {
                         if (hooks (DWT.EraseItem)) {
                             RECT itemRect = item.getBounds (index, true, true, false, false, true, hDC);
@@ -448,21 +450,21 @@
                             itemRect.right += EXPLORER_EXTRA + 1;
                             pClipRect.left = itemRect.left;
                             pClipRect.right = itemRect.right;
-                            if (count > 0 && hwndHeader !is 0) {
-                                HDITEM hdItem = new HDITEM ();
+                            if (count > 0 && hwndHeader !is null) {
+                                HDITEM hdItem;
                                 hdItem.mask = OS.HDI_WIDTH;
-                                OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, hdItem);
-                                pClipRect.right = Math.min (pClipRect.right, nmcd.left + hdItem.cxy);
+                                OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, &hdItem);
+                                pClipRect.right = Math.min (pClipRect.right, nmcd.nmcd.rc.left + hdItem.cxy);
                             }
                         }
-                        RECT pRect = new RECT ();
-                        OS.SetRect (pRect, nmcd.left, nmcd.top, nmcd.right, nmcd.bottom);
-                        if (count > 0 && hwndHeader !is 0) {
+                        RECT pRect;
+                        OS.SetRect (&pRect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom);
+                        if (count > 0 && hwndHeader !is null) {
                             int totalWidth = 0;
-                            HDITEM hdItem = new HDITEM ();
+                            HDITEM hdItem;
                             hdItem.mask = OS.HDI_WIDTH;
                             for (int j=0; j<count; j++) {
-                                OS.SendMessage (hwndHeader, OS.HDM_GETITEM, j, hdItem);
+                                OS.SendMessage (hwndHeader, OS.HDM_GETITEM, j, &hdItem);
                                 totalWidth += hdItem.cxy;
                             }
                             if (totalWidth > clientRect.right - clientRect.left) {
@@ -474,13 +476,13 @@
                             }
                         }
                         draw = false;
-                        int hTheme = OS.OpenThemeData (handle, Display.TREEVIEW);
+                        auto hTheme = OS.OpenThemeData (handle, cast(TCHAR*) Display.TREEVIEW);
                         int iStateId = selected ? OS.TREIS_SELECTED : OS.TREIS_HOT;
                         if (OS.GetFocus () !is handle && selected && !hot) iStateId = OS.TREIS_SELECTEDNOTFOCUS;
-                        OS.DrawThemeBackground (hTheme, hDC, OS.TVP_TREEITEM, iStateId, pRect, pClipRect);
+                        OS.DrawThemeBackground (hTheme, hDC, OS.TVP_TREEITEM, iStateId, &pRect, &pClipRect);
                         OS.CloseThemeData (hTheme);
                     }
-                    if (draw) fillBackground (hDC, OS.GetBkColor (hDC), pClipRect);
+                    if (draw) fillBackground (hDC, OS.GetBkColor (hDC), &pClipRect);
                 }
             } else {
                 if (explorerTheme && hooks (DWT.EraseItem)) {
@@ -491,17 +493,19 @@
                         pRect.right += EXPLORER_EXTRA;
                         pClipRect.left -= EXPLORER_EXTRA;
                         pClipRect.right += EXPLORER_EXTRA;
-                        int hTheme = OS.OpenThemeData (handle, Display.TREEVIEW);
+                        auto hTheme = OS.OpenThemeData (handle, cast(TCHAR*) Display.TREEVIEW);
                         int iStateId = selected ? OS.TREIS_SELECTED : OS.TREIS_HOT;
                         if (OS.GetFocus () !is handle && selected && !hot) iStateId = OS.TREIS_SELECTEDNOTFOCUS;
-                        OS.DrawThemeBackground (hTheme, hDC, OS.TVP_TREEITEM, iStateId, pRect, pClipRect);
+                        OS.DrawThemeBackground (hTheme, hDC, OS.TVP_TREEITEM, iStateId, &pRect, &pClipRect);
                         OS.CloseThemeData (hTheme);
                     }
                 }
             }
         }
         if (x + width > clientRect.left) {
-            RECT rect = new RECT (), backgroundRect = null;
+            RECT rect;
+            RECT* backgroundRect = null;
+            RECT rectTmp;
             bool drawItem = true, drawText = true, drawImage = true, drawBackground = false;
             if (i is 0) {
                 drawItem = drawImage = drawText = false;
@@ -525,7 +529,7 @@
                                     RECT iconRect = item.getBounds (index, false, true, false, false, true, hDC);
                                     gc.setClipping (iconRect.left, iconRect.top, iconRect.right - iconRect.left, iconRect.bottom - iconRect.top);
                                     gc.drawImage (image, 0, 0, bounds.width, bounds.height, iconRect.left, iconRect.top, size.x, size.y);
-                                    OS.SelectClipRgn (hDC, 0);
+                                    OS.SelectClipRgn (hDC, null);
                                     gc.dispose ();
                                 }
                             }
@@ -540,28 +544,29 @@
                     }
                 }
                 if (selected && !ignoreDrawSelection && !ignoreDrawBackground) {
-                    if (!explorerTheme) fillBackground (hDC, OS.GetBkColor (hDC), rect);
+                    if (!explorerTheme) fillBackground (hDC, OS.GetBkColor (hDC), &rect);
                     drawBackground = false;
                 }
-                backgroundRect = rect;
+                backgroundRect = &rect;
                 if (hooks (DWT.EraseItem)) {
                     drawItem = drawText = drawImage = true;
                     rect = item.getBounds (index, true, true, false, false, true, hDC);
                     if ((style & DWT.FULL_SELECTION) !is 0) {
-                        backgroundRect = rect;
+                        backgroundRect = &rect;
                     } else {
-                        backgroundRect = item.getBounds (index, true, false, false, false, true, hDC);
+                        rectTmp = item.getBounds (index, true, false, false, false, true, hDC);
+                        backgroundRect = &rectTmp;
                     }
                 }
             } else {
                 selectionForeground = -1;
                 ignoreDrawForeground = ignoreDrawBackground = ignoreDrawSelection = ignoreDrawFocus = ignoreDrawHot = false;
-                OS.SetRect (rect, x, nmcd.top, x + width, nmcd.bottom);
-                backgroundRect = rect;
+                OS.SetRect (&rect, x, nmcd.nmcd.rc.top, x + width, nmcd.nmcd.rc.bottom);
+                backgroundRect = &rect;
             }
             int clrText = -1, clrTextBk = -1;
-            int hFont = item.cellFont !is null ? item.cellFont [index] : -1;
-            if (hFont is -1) hFont = item.font;
+            HFONT hFont = item.cellFont !is null ? item.cellFont [index] : cast(HFONT)-1;
+            if (hFont is cast(HFONT)-1) hFont = item.font;
             if (selectionForeground !is -1) clrText = selectionForeground;
             if (OS.IsWindowEnabled (handle)) {
                 bool drawForeground = false;
@@ -590,7 +595,7 @@
                 }
             }
             if (explorerTheme) {
-                if (selected || (nmcd.uItemState & OS.CDIS_HOT) !is 0) {
+                if (selected || (nmcd.nmcd.uItemState & OS.CDIS_HOT) !is 0) {
                     if ((style & DWT.FULL_SELECTION) !is 0) {
                         drawBackground = false;
                     } else {
@@ -650,7 +655,7 @@
                             if (selected) event.detail |= DWT.SELECTED;
                             if (!explorerTheme) {
                                 //if ((nmcd.uItemState & OS.CDIS_FOCUS) !is 0) {
-                                if (OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0) is nmcd.dwItemSpec) {
+                                if (OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0) is nmcd.nmcd.dwItemSpec) {
                                     if (handle is OS.GetFocus ()) {
                                         int uiState = OS.SendMessage (handle, OS.WM_QUERYUISTATE, 0, 0);
                                         if ((uiState & OS.UISF_HIDEFOCUS) is 0) event.detail |= DWT.FOCUSED;
@@ -696,19 +701,19 @@
                                             clrTextBk = OS.GetSysColor (OS.COLOR_3DFACE);
                                         }
                                         if (!ignoreFullSelection && index is count - 1) {
-                                            RECT selectionRect = new RECT ();
-                                            OS.SetRect (selectionRect, backgroundRect.left, backgroundRect.top, nmcd.right, backgroundRect.bottom);
+                                            RECT* selectionRect = new RECT ();
+                                            OS.SetRect (selectionRect, backgroundRect.left, backgroundRect.top, nmcd.nmcd.rc.right, backgroundRect.bottom);
                                             backgroundRect = selectionRect;
                                         }
                                     } else {
-                                        RECT pRect = new RECT ();
-                                        OS.SetRect (pRect, nmcd.left, nmcd.top, nmcd.right, nmcd.bottom);
-                                        if (count > 0 && hwndHeader !is 0) {
+                                        RECT pRect;
+                                        OS.SetRect (&pRect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom);
+                                        if (count > 0 && hwndHeader !is null) {
                                             int totalWidth = 0;
-                                            HDITEM hdItem = new HDITEM ();
+                                            HDITEM hdItem;
                                             hdItem.mask = OS.HDI_WIDTH;
                                             for (int j=0; j<count; j++) {
-                                                OS.SendMessage (hwndHeader, OS.HDM_GETITEM, j, hdItem);
+                                                OS.SendMessage (hwndHeader, OS.HDM_GETITEM, j, &hdItem);
                                                 totalWidth += hdItem.cxy;
                                             }
                                             if (totalWidth > clientRect.right - clientRect.left) {
@@ -719,15 +724,15 @@
                                                 pRect.right = clientRect.right;
                                             }
                                             if (index is count - 1) {
-                                                RECT selectionRect = new RECT ();
+                                                RECT* selectionRect = new RECT ();
                                                 OS.SetRect (selectionRect, backgroundRect.left, backgroundRect.top, pRect.right, backgroundRect.bottom);
                                                 backgroundRect = selectionRect;
                                             }
                                         }
-                                        int hTheme = OS.OpenThemeData (handle, Display.TREEVIEW);
+                                        auto hTheme = OS.OpenThemeData (handle, cast(TCHAR*) Display.TREEVIEW);
                                         int iStateId = selected ? OS.TREIS_SELECTED : OS.TREIS_HOT;
                                         if (OS.GetFocus () !is handle && selected && !hot) iStateId = OS.TREIS_SELECTEDNOTFOCUS;
-                                        OS.DrawThemeBackground (hTheme, hDC, OS.TVP_TREEITEM, iStateId, pRect, backgroundRect);
+                                        OS.DrawThemeBackground (hTheme, hDC, OS.TVP_TREEITEM, iStateId, &pRect, backgroundRect);
                                         OS.CloseThemeData (hTheme);
                                     }
                                 }
@@ -755,10 +760,10 @@
                         if (control !is null) {
                             if (i is 0) {
                                 int right = Math.min (rect.right, width);
-                                OS.SetRect (rect, rect.left, rect.top, right, rect.bottom);
-                                if (drawBackground) fillImageBackground (hDC, control, rect);
+                                OS.SetRect (&rect, rect.left, rect.top, right, rect.bottom);
+                                if (drawBackground) fillImageBackground (hDC, control, &rect);
                             } else {
-                                if (drawBackground) fillImageBackground (hDC, control, rect);
+                                if (drawBackground) fillImageBackground (hDC, control, &rect);
                             }
                         }
                     }
@@ -790,7 +795,7 @@
                             gc.drawImage (image, 0, 0, bounds.width, bounds.height, rect.left - inset + 1, y, size.x, size.y);
                             gc.dispose ();
                         }
-                        OS.SetRect (rect, rect.left + size.x + offset, rect.top, rect.right - inset, rect.bottom);
+                        OS.SetRect (&rect, rect.left + size.x + offset, rect.top, rect.right - inset, rect.bottom);
                     } else {
                         if (i is 0) {
                             if (OS.SendMessage (handle, OS.TVM_GETIMAGELIST, OS.TVSIL_NORMAL, 0) !is 0) {
@@ -798,7 +803,7 @@
                                 rect.left = Math.min (rect.left + size.x + offset, rect.right);
                             }
                         } else {
-                            OS.SetRect (rect, rect.left + offset, rect.top, rect.right - inset, rect.bottom);
+                            OS.SetRect (&rect, rect.left + offset, rect.top, rect.right - inset, rect.bottom);
                         }
                     }
                 }
@@ -818,7 +823,7 @@
                             if (strings !is null) string = strings [index];
                         }
                         if (string !is null) {
-                            if (hFont !is -1) hFont = OS.SelectObject (hDC, hFont);
+                            if (hFont !is cast(HFONT)-1) hFont = OS.SelectObject (hDC, hFont);
                             if (clrText !is -1) clrText = OS.SetTextColor (hDC, clrText);
                             if (clrTextBk !is -1) clrTextBk = OS.SetBkColor (hDC, clrTextBk);
                             int flags = OS.DT_NOPREFIX | OS.DT_SINGLELINE | OS.DT_VCENTER;
@@ -828,10 +833,10 @@
                                 if ((column.style & DWT.CENTER) !is 0) flags |= OS.DT_CENTER;
                                 if ((column.style & DWT.RIGHT) !is 0) flags |= OS.DT_RIGHT;
                             }
-                            TCHAR buffer = new TCHAR (getCodePage (), string, false);
-                            if (!ignoreDrawForeground) OS.DrawText (hDC, buffer, buffer.length (), rect, flags);
-                            OS.DrawText (hDC, buffer, buffer.length (), rect, flags | OS.DT_CALCRECT);
-                            if (hFont !is -1) hFont = OS.SelectObject (hDC, hFont);
+                            TCHAR[] buffer = StrToTCHARs (getCodePage (), string, false);
+                            if (!ignoreDrawForeground) OS.DrawText (hDC, buffer.ptr, buffer.length, &rect, flags);
+                            OS.DrawText (hDC, buffer.ptr, buffer.length, &rect, flags | OS.DT_CALCRECT);
+                            if (hFont !is cast(HFONT)-1) hFont = OS.SelectObject (hDC, hFont);
                             if (clrText !is -1) clrText = OS.SetTextColor (hDC, clrText);
                             if (clrTextBk !is -1) clrTextBk = OS.SetBkColor (hDC, clrTextBk);
                         }
@@ -867,7 +872,7 @@
                 }
                 if (!explorerTheme) {
                     //if ((nmcd.uItemState & OS.CDIS_FOCUS) !is 0) {
-                    if (OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0) is nmcd.dwItemSpec) {
+                    if (OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0) is nmcd.nmcd.dwItemSpec) {
                         if (i is 0 /*nmcd.iSubItem is 0*/ || (style & DWT.FULL_SELECTION) !is 0) {
                             if (handle is OS.GetFocus ()) {
                                 int uiState = OS.SendMessage (handle, OS.WM_QUERYUISTATE, 0, 0);
@@ -896,62 +901,62 @@
     }
     if (linesVisible) {
         if ((style & DWT.FULL_SELECTION) !is 0) {
-            if (hwndHeader !is 0) {
+            if (hwndHeader !is null) {
                 if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0) !is 0) {
-                    HDITEM hdItem = new HDITEM ();
+                    HDITEM hdItem;
                     hdItem.mask = OS.HDI_WIDTH;
-                    OS.SendMessage (hwndHeader, OS.HDM_GETITEM, 0, hdItem);
-                    RECT rect = new RECT ();
-                    OS.SetRect (rect, nmcd.left + hdItem.cxy, nmcd.top, nmcd.right, nmcd.bottom);
-                    OS.DrawEdge (hDC, rect, OS.BDR_SUNKENINNER, OS.BF_BOTTOM);
+                    OS.SendMessage (hwndHeader, OS.HDM_GETITEM, 0, &hdItem);
+                    RECT rect;
+                    OS.SetRect (&rect, nmcd.nmcd.rc.left + hdItem.cxy, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom);
+                    OS.DrawEdge (hDC, &rect, OS.BDR_SUNKENINNER, OS.BF_BOTTOM);
                 }
             }
         }
-        RECT rect = new RECT ();
-        OS.SetRect (rect, nmcd.left, nmcd.top, nmcd.right, nmcd.bottom);
-        OS.DrawEdge (hDC, rect, OS.BDR_SUNKENINNER, OS.BF_BOTTOM);
+        RECT rect;
+        OS.SetRect (&rect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom);
+        OS.DrawEdge (hDC, &rect, OS.BDR_SUNKENINNER, OS.BF_BOTTOM);
     }
     if (!explorerTheme) {
         if (handle is OS.GetFocus ()) {
             int uiState = OS.SendMessage (handle, OS.WM_QUERYUISTATE, 0, 0);
             if ((uiState & OS.UISF_HIDEFOCUS) is 0) {
-                int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
+                auto hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
                 if (hItem is item.handle) {
                     if (!ignoreDrawFocus && findImageControl () !is null) {
                         if ((style & DWT.FULL_SELECTION) !is 0) {
-                            RECT focusRect = new RECT ();
-                            OS.SetRect (focusRect, nmcd.left, nmcd.top, nmcd.right, nmcd.bottom);
-                            if (count > 0 && hwndHeader !is 0) {
+                            RECT focusRect;
+                            OS.SetRect (&focusRect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom);
+                            if (count > 0 && hwndHeader !is null) {
                                 int width = 0;
-                                HDITEM hdItem = new HDITEM ();
+                                HDITEM hdItem;
                                 hdItem.mask = OS.HDI_WIDTH;
                                 for (int j=0; j<count; j++) {
-                                    OS.SendMessage (hwndHeader, OS.HDM_GETITEM, j, hdItem);
+                                    OS.SendMessage (hwndHeader, OS.HDM_GETITEM, j, &hdItem);
                                     width += hdItem.cxy;
                                 }
                                 focusRect.left = 0;
-                                RECT rect = new RECT ();
-                                OS.GetClientRect (handle, rect);
+                                RECT rect;
+                                OS.GetClientRect (handle, &rect);
                                 focusRect.right = Math.max (width, rect.right - OS.GetSystemMetrics (OS.SM_CXVSCROLL));
                             }
-                            OS.DrawFocusRect (hDC, focusRect);
+                            OS.DrawFocusRect (hDC, &focusRect);
                         } else {
                             int index = OS.SendMessage (hwndHeader, OS.HDM_ORDERTOINDEX, 0, 0);
                             RECT focusRect = item.getBounds (index, true, false, false, false, false, hDC);
                             RECT clipRect = item.getBounds (index, true, false, false, false, true, hDC);
                             OS.IntersectClipRect (hDC, clipRect.left, clipRect.top, clipRect.right, clipRect.bottom);
-                            OS.DrawFocusRect (hDC, focusRect);
-                            OS.SelectClipRgn (hDC, 0);
+                            OS.DrawFocusRect (hDC, &focusRect);
+                            OS.SelectClipRgn (hDC, null);
                         }
                     }
                 }
             }
         }
     }
-    return new LRESULT (OS.CDRF_DODEFAULT);
-}
-
-LRESULT CDDS_ITEMPREPAINT (NMTVCUSTOMDRAW nmcd, int wParam, int lParam) {
+    return cast(LRESULT) (OS.CDRF_DODEFAULT);
+}
+
+LRESULT CDDS_ITEMPREPAINT (NMTVCUSTOMDRAW* nmcd, int wParam, int lParam) {
     /*
     * Even when custom draw is being ignored, the font needs
     * to be selected into the HDC so that the item bounds are
@@ -968,18 +973,18 @@
     * NOTE: This only happens on XP with the version 6.00 of
     * COMCTL32.DLL,
     */
-    if (item is null) return null;
-    int hDC = nmcd.hdc;
-    int index = hwndHeader !is 0 ? OS.SendMessage (hwndHeader, OS.HDM_ORDERTOINDEX, 0, 0) : 0;
-    int hFont = item.cellFont !is null ? item.cellFont [index] : -1;
-    if (hFont is -1) hFont = item.font;
-    if (hFont !is -1) OS.SelectObject (hDC, hFont);
-    if (ignoreCustomDraw || nmcd.left is nmcd.right) {
-        return new LRESULT (hFont is -1 ? OS.CDRF_DODEFAULT : OS.CDRF_NEWFONT);
+    if (item is null) return LRESULT.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);
     }
     int count = 0;
-    RECT clipRect = null;
-    if (hwndHeader !is 0) {
+    RECT* clipRect = null;
+    if (hwndHeader !is null) {
         count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
         if (count !is 0) {
             bool clip = !printClient;
@@ -988,10 +993,10 @@
             }
             if (clip) {
                 clipRect = new RECT ();
-                HDITEM hdItem = new HDITEM ();
+                HDITEM hdItem;
                 hdItem.mask = OS.HDI_WIDTH;
-                OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, hdItem);
-                OS.SetRect (clipRect, nmcd.left, nmcd.top, nmcd.left + hdItem.cxy, nmcd.bottom);
+                OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, &hdItem);
+                OS.SetRect (clipRect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.left + hdItem.cxy, nmcd.nmcd.rc.bottom);
             }
         }
     }
@@ -1014,13 +1019,13 @@
         }
     }
     bool selected = isItemSelected (nmcd);
-    bool hot = explorerTheme && (nmcd.uItemState & OS.CDIS_HOT) !is 0;
-    if (OS.IsWindowVisible (handle) && nmcd.left < nmcd.right && nmcd.top < nmcd.bottom) {
-        if (hFont !is -1) OS.SelectObject (hDC, hFont);
+    bool hot = explorerTheme && (nmcd.nmcd.uItemState & OS.CDIS_HOT) !is 0;
+    if (OS.IsWindowVisible (handle) && nmcd.nmcd.rc.left < nmcd.nmcd.rc.right && nmcd.nmcd.rc.top < nmcd.nmcd.rc.bottom) {
+        if (hFont !is cast(HFONT)-1) OS.SelectObject (hDC, hFont);
         if (linesVisible) {
-            RECT rect = new RECT ();
-            OS.SetRect (rect, nmcd.left, nmcd.top, nmcd.right, nmcd.bottom);
-            OS.DrawEdge (hDC, rect, OS.BDR_SUNKENINNER, OS.BF_BOTTOM);
+            RECT rect;
+            OS.SetRect (&rect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom);
+            OS.DrawEdge (hDC, &rect, OS.BDR_SUNKENINNER, OS.BF_BOTTOM);
         }
         //TODO - BUG - measure and erase sent when first column is clipped
         if (hooks (DWT.MeasureItem)) {
@@ -1042,8 +1047,8 @@
             event.gc = null;
             gc.dispose ();
             OS.RestoreDC (hDC, nSavedDC);
-            if (isDisposed () || item.isDisposed ()) return null;
-            if (hwndHeader !is 0) {
+            if (isDisposed () || item.isDisposed ()) return LRESULT.NULL;
+            if (hwndHeader !is null) {
                 if (count is 0) {
                     if (event.x + event.width > scrollWidth) {
                         setScrollWidth (scrollWidth = event.x + event.width);
@@ -1055,17 +1060,17 @@
         selectionForeground = -1;
         ignoreDrawForeground = ignoreDrawBackground = ignoreDrawSelection = ignoreDrawFocus = ignoreDrawHot = ignoreFullSelection = false;
         if (hooks (DWT.EraseItem)) {
-            RECT rect = new RECT ();
-            OS.SetRect (rect, nmcd.left, nmcd.top, nmcd.right, nmcd.bottom);
+            RECT rect;
+            OS.SetRect (&rect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom);
             if (OS.IsWindowEnabled (handle) || findImageControl () !is null) {
-                drawBackground (hDC, rect);
+                drawBackground (hDC, &rect);
             } else {
-                fillBackground (hDC, OS.GetBkColor (hDC), rect);
+                fillBackground (hDC, OS.GetBkColor (hDC), &rect);
             }
             RECT cellRect = item.getBounds (index, true, true, true, true, true, hDC);
             if (clrSortBk !is -1) {
                 RECT fullRect = item.getBounds (index, true, true, true, true, true, hDC);
-                drawBackground (hDC, fullRect, clrSortBk);
+                drawBackground (hDC, &fullRect, clrSortBk);
             }
             int nSavedDC = OS.SaveDC (hDC);
             GCData data = new GCData ();
@@ -1081,7 +1086,7 @@
                 if (clrTextBk !is -1) data.background = clrTextBk;
             }
             data.uiState = OS.SendMessage (handle, OS.WM_QUERYUISTATE, 0, 0);
-            if (hFont !is -1) data.hFont = hFont;
+            if (hFont !is cast(HFONT)-1) data.hFont = hFont;
             GC gc = GC.win32_new (hDC, data);
             Event event = new Event ();
             event.index = index;
@@ -1093,7 +1098,7 @@
             if (selected) event.detail |= DWT.SELECTED;
             if (!explorerTheme) {
                 //if ((nmcd.uItemState & OS.CDIS_FOCUS) !is 0) {
-                if (OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0) is nmcd.dwItemSpec) {
+                if (OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0) is nmcd.nmcd.dwItemSpec) {
                     if (handle is OS.GetFocus ()) {
                         int uiState = OS.SendMessage (handle, OS.WM_QUERYUISTATE, 0, 0);
                         if ((uiState & OS.UISF_HIDEFOCUS) is 0) event.detail |= DWT.FOCUSED;
@@ -1110,7 +1115,7 @@
             int newTextClr = data.foreground;
             gc.dispose ();
             OS.RestoreDC (hDC, nSavedDC);
-            if (isDisposed () || item.isDisposed ()) return null;
+            if (isDisposed () || item.isDisposed ()) return LRESULT.NULL;
             if (event.doit) {
                 ignoreDrawForeground = (event.detail & DWT.FOREGROUND) is 0;
                 ignoreDrawBackground = (event.detail & DWT.BACKGROUND) is 0;
@@ -1127,13 +1132,13 @@
                 if (draw) {
                     if (count is 0) {
                         if ((style & DWT.FULL_SELECTION) !is 0) {
-                            fillBackground (hDC, clrTextBk, rect);
+                            fillBackground (hDC, clrTextBk, &rect);
                         } else {
                             RECT textRect = item.getBounds (index, true, false, true, false, true, hDC);
-                            fillBackground (hDC, clrTextBk, textRect);
+                            fillBackground (hDC, clrTextBk, &textRect);
                         }
                     } else {
-                        fillBackground (hDC, clrTextBk, cellRect);
+                        fillBackground (hDC, clrTextBk, &cellRect);
                     }
                 }
             }
@@ -1152,13 +1157,13 @@
                     */
                     if ((style & DWT.FULL_SELECTION) !is 0) {
                         if ((style & DWT.FULL_SELECTION) !is 0 && count is 0) {
-                            fillBackground (hDC, OS.GetBkColor (hDC), rect);
+                            fillBackground (hDC, OS.GetBkColor (hDC), &rect);
                         } else {
-                            fillBackground (hDC, OS.GetBkColor (hDC), cellRect);
+                            fillBackground (hDC, OS.GetBkColor (hDC), &cellRect);
                         }
                     } else {
                         RECT textRect = item.getBounds (index, true, false, false, false, true, hDC);
-                        fillBackground (hDC, OS.GetBkColor (hDC), textRect);
+                        fillBackground (hDC, OS.GetBkColor (hDC), &textRect);
                     }
                 }
             } else {
@@ -1167,7 +1172,7 @@
                     ignoreDrawSelection = ignoreDrawHot = true;
                 }
                 if (explorerTheme) {
-                    nmcd.uItemState |= OS.CDIS_DISABLED;
+                    nmcd.nmcd.uItemState |= OS.CDIS_DISABLED;
                     /*
                     * Feature in Windows.  On Vista only, when the text
                     * color is unchanged and an item is asked to draw
@@ -1185,12 +1190,12 @@
                 }
             }
             if (explorerTheme) {
-                if (selected || (hot && ignoreDrawHot)) nmcd.uItemState &= ~OS.CDIS_HOT;
-                OS.MoveMemory (lParam, nmcd, NMTVCUSTOMDRAW.sizeof);
+                if (selected || (hot && ignoreDrawHot)) nmcd.nmcd.uItemState &= ~OS.CDIS_HOT;
+                OS.MoveMemory (cast(void*)lParam, nmcd, NMTVCUSTOMDRAW.sizeof);
             }
             RECT itemRect = item.getBounds (index, true, true, false, false, false, hDC);
             OS.SaveDC (hDC);
-            OS.SelectClipRgn (hDC, 0);
+            OS.SelectClipRgn (hDC, null);
             if (explorerTheme) {
                 itemRect.left -= EXPLORER_EXTRA;
                 itemRect.right += EXPLORER_EXTRA;
@@ -1202,7 +1207,7 @@
                 OS.IntersectClipRect (hDC, clipRect.left, clipRect.top, clipRect.right, clipRect.bottom);
             }
             OS.ExcludeClipRect (hDC, itemRect.left, itemRect.top, itemRect.right, itemRect.bottom);
-            return new LRESULT (OS.CDRF_DODEFAULT | OS.CDRF_NOTIFYPOSTPAINT);
+            return cast(LRESULT) (OS.CDRF_DODEFAULT | OS.CDRF_NOTIFYPOSTPAINT);
         }
         /*
         * Feature in Windows.  When the tree has the style
@@ -1214,24 +1219,24 @@
         if ((style & DWT.FULL_SELECTION) !is 0) {
             int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
             if ((bits & OS.TVS_FULLROWSELECT) is 0) {
-                RECT rect = new RECT ();
-                OS.SetRect (rect, nmcd.left, nmcd.top, nmcd.right, nmcd.bottom);
+                RECT rect;
+                OS.SetRect (&rect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom);
                 if (selected) {
-                    fillBackground (hDC, OS.GetBkColor (hDC), rect);
+                    fillBackground (hDC, OS.GetBkColor (hDC), &rect);
                 } else {
-                    if (OS.IsWindowEnabled (handle)) drawBackground (hDC, rect);
+                    if (OS.IsWindowEnabled (handle)) drawBackground (hDC, &rect);
                 }
-                nmcd.uItemState &= ~OS.CDIS_FOCUS;
-                OS.MoveMemory (lParam, nmcd, NMTVCUSTOMDRAW.sizeof);
-            }
-        }
-    }
-    LRESULT result = null;
-    if (clrText is -1 && clrTextBk is -1 && hFont is -1) {
-        result = new LRESULT (OS.CDRF_DODEFAULT | OS.CDRF_NOTIFYPOSTPAINT);
+                nmcd.nmcd.uItemState &= ~OS.CDIS_FOCUS;
+                OS.MoveMemory (cast(void*)lParam, nmcd, NMTVCUSTOMDRAW.sizeof);
+            }
+        }
+    }
+    LRESULT result = LRESULT.NULL;
+    if (clrText is -1 && clrTextBk is -1 && hFont is cast(HFONT)-1) {
+        result = cast(LRESULT) (OS.CDRF_DODEFAULT | OS.CDRF_NOTIFYPOSTPAINT);
     } else {
-        result = new LRESULT (OS.CDRF_NEWFONT | OS.CDRF_NOTIFYPOSTPAINT);
-        if (hFont !is -1) OS.SelectObject (hDC, hFont);
+        result = cast(LRESULT) (OS.CDRF_NEWFONT | OS.CDRF_NOTIFYPOSTPAINT);
+        if (hFont !is cast(HFONT)-1) OS.SelectObject (hDC, hFont);
         if (OS.IsWindowEnabled (handle) && OS.IsWindowVisible (handle)) {
             /*
             * Feature in Windows.  Windows does not fill the entire cell
@@ -1241,33 +1246,33 @@
             if (clrTextBk !is -1) {
                 int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
                 if ((bits & OS.TVS_FULLROWSELECT) is 0) {
-                    if (count !is 0 && hwndHeader !is 0) {
-                        RECT rect = new RECT ();
-                        HDITEM hdItem = new HDITEM ();
+                    if (count !is 0 && hwndHeader !is null) {
+                        RECT rect;
+                        HDITEM hdItem;
                         hdItem.mask = OS.HDI_WIDTH;
-                        OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, hdItem);
-                        OS.SetRect (rect, nmcd.left, nmcd.top, nmcd.left + hdItem.cxy, nmcd.bottom);
+                        OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, &hdItem);
+                        OS.SetRect (&rect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.left + hdItem.cxy, nmcd.nmcd.rc.bottom);
                         if (OS.COMCTL32_MAJOR < 6 || !OS.IsAppThemed ()) {
-                            RECT itemRect = new RECT ();
-                            itemRect.left = item.handle;
-                            if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, itemRect) !is 0) {
+                            RECT itemRect;
+                            itemRect.left = cast(int) item.handle;
+                            if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, &itemRect) !is 0) {
                                 rect.left = Math.min (itemRect.left, rect.right);
                             }
                         }
                         if ((style & DWT.FULL_SELECTION) !is 0) {
-                            if (!selected) fillBackground (hDC, clrTextBk, rect);
+                            if (!selected) fillBackground (hDC, clrTextBk, &rect);
                         } else {
                             if (explorerTheme) {
-                                if (!selected && !hot) fillBackground (hDC, clrTextBk, rect);
+                                if (!selected && !hot) fillBackground (hDC, clrTextBk, &rect);
                             } else {
-                                fillBackground (hDC, clrTextBk, rect);
+                                fillBackground (hDC, clrTextBk, &rect);
                             }
                         }
                     } else {
                         if ((style & DWT.FULL_SELECTION) !is 0) {
-                            RECT rect = new RECT ();
-                            OS.SetRect (rect, nmcd.left, nmcd.top, nmcd.right, nmcd.bottom);
-                            if (!selected) fillBackground (hDC, clrTextBk, rect);
+                            RECT rect;
+                            OS.SetRect (&rect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom);
+                            if (!selected) fillBackground (hDC, clrTextBk, &rect);
                         }
                     }
                 }
@@ -1291,8 +1296,8 @@
         */
         if (explorerTheme) {
             if (findImageControl () !is  null) {
-                if (!selected && (nmcd.uItemState & (OS.CDIS_HOT | OS.CDIS_SELECTED)) is 0) {
-                    nmcd.uItemState |= OS.CDIS_DISABLED;
+                if (!selected && (nmcd.nmcd.uItemState & (OS.CDIS_HOT | OS.CDIS_SELECTED)) is 0) {
+                    nmcd.nmcd.uItemState |= OS.CDIS_DISABLED;
                     /*
                     * Feature in Windows.  On Vista only, when the text
                     * color is unchanged and an item is asked to draw
@@ -1309,19 +1314,19 @@
                     OS.MoveMemory (lParam, nmcd, NMTVCUSTOMDRAW.sizeof);
                     if (clrTextBk !is -1) {
                         if ((style & DWT.FULL_SELECTION) !is 0) {
-                            RECT rect = new RECT ();
+                            RECT rect;
                             if (count !is 0) {
-                                HDITEM hdItem = new HDITEM ();
+                                HDITEM hdItem;
                                 hdItem.mask = OS.HDI_WIDTH;
-                                OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, hdItem);
-                                OS.SetRect (rect, nmcd.left, nmcd.top, nmcd.left + hdItem.cxy, nmcd.bottom);
+                                OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, &hdItem);
+                                OS.SetRect (&rect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.left + hdItem.cxy, nmcd.nmcd.rc.bottom);
                             } else {
-                                OS.SetRect (rect, nmcd.left, nmcd.top, nmcd.right, nmcd.bottom);
+                                OS.SetRect (&rect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom);
                             }
-                            fillBackground (hDC, clrTextBk, rect);
+                            fillBackground (hDC, clrTextBk, &rect);
                         } else {
                             RECT textRect = item.getBounds (index, true, false, true, false, true, hDC);
-                            fillBackground (hDC, clrTextBk, textRect);
+                            fillBackground (hDC, clrTextBk, &textRect);
                         }
                     }
                 }
@@ -1334,19 +1339,19 @@
         * to fill the background with the sort column color.
         */
         if (clrSortBk !is -1) {
-            RECT rect = new RECT ();
-            HDITEM hdItem = new HDITEM ();
+            RECT rect;
+            HDITEM hdItem;
             hdItem.mask = OS.HDI_WIDTH;
-            OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, hdItem);
-            OS.SetRect (rect, nmcd.left, nmcd.top, nmcd.left + hdItem.cxy, nmcd.bottom);
-            fillBackground (hDC, clrSortBk, rect);
+            OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, &hdItem);
+            OS.SetRect (&rect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.left + hdItem.cxy, nmcd.nmcd.rc.bottom);
+            fillBackground (hDC, clrSortBk, &rect);
         }
     }
     OS.SaveDC (hDC);
     if (clipRect !is null) {
-        int hRgn = OS.CreateRectRgn (clipRect.left, clipRect.top, clipRect.right, clipRect.bottom);
-        POINT lpPoint = new POINT ();
-        OS.GetWindowOrgEx (hDC, lpPoint);
+        auto hRgn = OS.CreateRectRgn (clipRect.left, clipRect.top, clipRect.right, clipRect.bottom);
+        POINT lpPoint;
+        OS.GetWindowOrgEx (hDC, &lpPoint);
         OS.OffsetRgn (hRgn, -lpPoint.x, -lpPoint.y);
         OS.SelectClipRgn (hDC, hRgn);
         OS.DeleteObject (hRgn);
@@ -1354,15 +1359,15 @@
     return result;
 }
 
-LRESULT CDDS_POSTPAINT (NMTVCUSTOMDRAW nmcd, int wParam, int lParam) {
-    if (ignoreCustomDraw) return null;
+LRESULT CDDS_POSTPAINT (NMTVCUSTOMDRAW* nmcd, int wParam, int lParam) {
+    if (ignoreCustomDraw) return LRESULT.NULL;
     if (OS.IsWindowVisible (handle)) {
         if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
             if (sortColumn !is null && sortDirection !is DWT.NONE) {
                 if (findImageControl () is null) {
                     int index = indexOf (sortColumn);
                     if (index !is -1) {
-                        int top = nmcd.top;
+                        int top = nmcd.nmcd.rc.top;
                         /*
                         * Bug in Windows.  For some reason, during a collapse,
                         * when TVM_GETNEXTITEM is sent with TVGN_LASTVISIBLE
@@ -1379,48 +1384,48 @@
                         * NOTE: This problem only happens on Vista during
                         * WM_NOTIFY with NM_CUSTOMDRAW and CDDS_POSTPAINT.
                         */
-                        int hItem = 0;
+                        HANDLE hItem;
                         if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
                             hItem = getBottomItem ();
                         } else {
-                            hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_LASTVISIBLE, 0);
+                            hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_LASTVISIBLE, 0);
                         }
-                        if (hItem !is 0) {
-                            RECT rect = new RECT ();
-                            rect.left = hItem;
-                            if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, rect) !is 0) {
+                        if (hItem !is null) {
+                            RECT rect;
+                            rect.left = cast(int) hItem;
+                            if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, &rect) !is 0) {
                                 top = rect.bottom;
                             }
                         }
-                        RECT rect = new RECT ();
-                        OS.SetRect (rect, nmcd.left, top, nmcd.right, nmcd.bottom);
-                        RECT headerRect = new RECT ();
-                        OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, headerRect);
+                        RECT rect;
+                        OS.SetRect (&rect, nmcd.nmcd.rc.left, top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom);
+                        RECT headerRect;
+                        OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, &headerRect);
                         rect.left = headerRect.left;
                         rect.right = headerRect.right;
-                        fillBackground (nmcd.hdc, getSortColumnPixel (), rect);
+                        fillBackground (nmcd.nmcd.hdc, getSortColumnPixel (), &rect);
                     }
                 }
             }
         }
         if (linesVisible) {
-            int hDC = nmcd.hdc;
-            if (hwndHeader !is 0) {
+            auto hDC = nmcd.nmcd.hdc;
+            if (hwndHeader !is null) {
                 int x = 0;
-                RECT rect = new RECT ();
-                HDITEM hdItem = new HDITEM ();
+                RECT rect;
+                HDITEM hdItem;
                 hdItem.mask = OS.HDI_WIDTH;
                 int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
                 for (int i=0; i<count; i++) {
                     int index = OS.SendMessage (hwndHeader, OS.HDM_ORDERTOINDEX, i, 0);
-                    OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, hdItem);
-                    OS.SetRect (rect, x, nmcd.top, x + hdItem.cxy, nmcd.bottom);
-                    OS.DrawEdge (hDC, rect, OS.BDR_SUNKENINNER, OS.BF_RIGHT);
+                    OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, &hdItem);
+                    OS.SetRect (&rect, x, nmcd.nmcd.rc.top, x + hdItem.cxy, nmcd.nmcd.rc.bottom);
+                    OS.DrawEdge (hDC, &rect, OS.BDR_SUNKENINNER, OS.BF_RIGHT);
                     x += hdItem.cxy;
                 }
             }
             int height = 0;
-            RECT rect = new RECT ();
+            RECT rect;
             /*
             * Bug in Windows.  For some reason, during a collapse,
             * when TVM_GETNEXTITEM is sent with TVGN_LASTVISIBLE
@@ -1437,52 +1442,52 @@
             * NOTE: This problem only happens on Vista during
             * WM_NOTIFY with NM_CUSTOMDRAW and CDDS_POSTPAINT.
             */
-            int hItem = 0;
+            HANDLE hItem;
             if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
                 hItem = getBottomItem ();
             } else {
-                hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_LASTVISIBLE, 0);
-            }
-            if (hItem !is 0) {
-                rect.left = hItem;
-                if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, rect) !is 0) {
+                hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_LASTVISIBLE, 0);
+            }
+            if (hItem !is null) {
+                rect.left = cast(int) hItem;
+                if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, &rect) !is 0) {
                     height = rect.bottom - rect.top;
                 }
             }
             if (height is 0) {
                 height = OS.SendMessage (handle, OS.TVM_GETITEMHEIGHT, 0, 0);
-                OS.GetClientRect (handle, rect);
-                OS.SetRect (rect, rect.left, rect.top, rect.right, rect.top + height);
-                OS.DrawEdge (hDC, rect, OS.BDR_SUNKENINNER, OS.BF_BOTTOM);
-            }
-            while (rect.bottom < nmcd.bottom) {
+                OS.GetClientRect (handle, &rect);
+                OS.SetRect (&rect, rect.left, rect.top, rect.right, rect.top + height);
+                OS.DrawEdge (hDC, &rect, OS.BDR_SUNKENINNER, OS.BF_BOTTOM);
+            }
+            while (rect.bottom < nmcd.nmcd.rc.bottom) {
                 int top = rect.top + height;
-                OS.SetRect (rect, rect.left, top, rect.right, top + height);
-                OS.DrawEdge (hDC, rect, OS.BDR_SUNKENINNER, OS.BF_BOTTOM);
-            }
-        }
-    }
-    return new LRESULT (OS.CDRF_DODEFAULT);
-}
-
-LRESULT CDDS_PREPAINT (NMTVCUSTOMDRAW nmcd, int wParam, int lParam) {
+                OS.SetRect (&rect, rect.left, top, rect.right, top + height);
+                OS.DrawEdge (hDC, &rect, OS.BDR_SUNKENINNER, OS.BF_BOTTOM);
+            }
+        }
+    }
+    return cast(LRESULT) (OS.CDRF_DODEFAULT);
+}
+
+LRESULT CDDS_PREPAINT (NMTVCUSTOMDRAW* nmcd, int wParam, int lParam) {
     if (explorerTheme) {
         if ((OS.IsWindowEnabled (handle) && hooks (DWT.EraseItem)) || findImageControl () !is null) {
-            RECT rect = new RECT ();
-            OS.SetRect (rect, nmcd.left, nmcd.top, nmcd.right, nmcd.bottom);
-            drawBackground (nmcd.hdc, rect);
-        }
-    }
-    return new LRESULT (OS.CDRF_NOTIFYITEMDRAW | OS.CDRF_NOTIFYPOSTPAINT);
+            RECT rect;
+            OS.SetRect (&rect, nmcd.nmcd.rc.left, nmcd.nmcd.rc.top, nmcd.nmcd.rc.right, nmcd.nmcd.rc.bottom);
+            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 0) return 0;
-    if (hwndParent !is 0 && hwnd is hwndParent) {
-        return OS.DefWindowProc (hwnd, msg, wParam, lParam);
-    }
-    if (hwndHeader !is 0 && hwnd is hwndHeader) {
-        return OS.CallWindowProc (HeaderProc, hwnd, msg, wParam, lParam);
+    if (handle is null) return LRESULT.NULL;
+    if (hwndParent !is null && hwnd is hwndParent) {
+        return cast(LRESULT) OS.DefWindowProc (hwnd, msg, wParam, lParam);
+    }
+    if (hwndHeader !is null && hwnd is hwndHeader) {
+        return cast(LRESULT) OS.CallWindowProc (HeaderProc, hwnd, msg, wParam, lParam);
     }
     switch (msg) {
         case OS.WM_SETFOCUS: {
@@ -1495,28 +1500,28 @@
             * only the focus is assigned.
             */
             if ((style & DWT.SINGLE) !is 0) break;
-            int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
-            if (hItem is 0) {
-                hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0);
-                if (hItem !is 0) {
-                    TVITEM tvItem = new TVITEM ();
+            HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
+            if (hItem is null) {
+                hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0);
+                if (hItem !is null) {
+                    TVITEM tvItem;
                     tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_STATE;
                     tvItem.hItem = hItem;
-                    OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
+                    OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem);
                     hSelect = hItem;
                     ignoreDeselect = ignoreSelect = lockSelection = true;
                     OS.SendMessage (handle, OS.TVM_SELECTITEM, OS.TVGN_CARET, hItem);
                     ignoreDeselect = ignoreSelect = lockSelection = false;
-                    hSelect = 0;
+                    hSelect = null;
                     if ((tvItem.state & OS.TVIS_SELECTED) is 0) {
-                        OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
+                        OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
                     }
                 }
             }
             break;
         }
     }
-    int hItem = 0;
+    HANDLE hItem;
     bool redraw = false;
     switch (msg) {
         /* Keyboard messages */
@@ -1565,7 +1570,7 @@
         case OS.WM_SETFONT:
         case OS.WM_TIMER: {
             if (findImageControl () !is null) {
-                hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0);
+                hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0);
             }
             break;
         }
@@ -1594,7 +1599,7 @@
             if (redraw) {
                 OS.DefWindowProc (handle, OS.WM_SETREDRAW, 1, 0);
                 OS.InvalidateRect (handle, null, true);
-                if (hwndHeader !is 0) OS.InvalidateRect (hwndHeader, null, true);
+                if (hwndHeader !is null) OS.InvalidateRect (hwndHeader, null, true);
             }
             //FALL THROUGH
 
@@ -1621,7 +1626,7 @@
         case OS.WM_SETFONT:
         case OS.WM_TIMER: {
             if (findImageControl () !is null) {
-                if (hItem !is OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0)) {
+                if (hItem !is cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0)) {
                     OS.InvalidateRect (handle, null, true);
                 }
             }
@@ -1633,7 +1638,7 @@
             painted = true;
             break;
     }
-    return code;
+    return cast(LRESULT) code;
 }
 
 override void checkBuffered () {
@@ -1675,10 +1680,10 @@
 }
 
 override bool checkHandle (HWND hwnd) {
-    return hwnd is handle || (hwndParent !is 0 && hwnd is hwndParent) || (hwndHeader !is 0 && hwnd is hwndHeader);
-}
-
-bool checkScroll (int hItem) {
+    return hwnd is handle || (hwndParent !is null && hwnd is hwndParent) || (hwndHeader !is null && hwnd is hwndHeader);
+}
+
+bool checkScroll (HANDLE hItem) {
     /*
     * Feature in Windows.  If redraw is turned off using WM_SETREDRAW
     * and a tree item that is not a child of the first root is selected or
@@ -1728,16 +1733,16 @@
  */
 public void clear (int index, bool all) {
     checkWidget ();
-    int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
-    if (hItem is 0) error (DWT.ERROR_INVALID_RANGE);
+    HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
+    if (hItem is null) error (DWT.ERROR_INVALID_RANGE);
     hItem = findItem (hItem, index);
-    if (hItem is 0) error (DWT.ERROR_INVALID_RANGE);
-    TVITEM tvItem = new TVITEM ();
+    if (hItem is null) error (DWT.ERROR_INVALID_RANGE);
+    TVITEM tvItem;
     tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM;
-    clear (hItem, tvItem);
+    clear (hItem, &tvItem);
     if (all) {
-        hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, hItem);
-        clearAll (hItem, tvItem, all);
+        hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, hItem);
+        clearAll (hItem, &tvItem, all);
     }
 }
 
@@ -1774,61 +1779,64 @@
  */
 public void clearAll (bool all) {
     checkWidget ();
-    int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
-    if (hItem is 0) return;
-    TVITEM tvItem = new TVITEM ();
+    HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
+    if (hItem is null) return;
+    TVITEM tvItem;
     tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM;
-    clearAll (hItem, tvItem, all);
+    clearAll (hItem, &tvItem, all);
 }
 
 void clearAll (HANDLE hItem, TVITEM* tvItem, bool all) {
-    while (hItem !is 0) {
+    while (hItem !is null) {
         clear (hItem, tvItem);
-        int hFirstItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, hItem);
+        auto hFirstItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, hItem);
         if (all) clearAll (hFirstItem, tvItem, all);
-        hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
-    }
-}
-
-int CompareFunc (int lParam1, int lParam2, int lParamSort) {
+        hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
+    }
+}
+
+private static extern(Windows) int CompareFunc (int lParam1, int lParam2, int lParamSort) {
+    return sThis.CompareProc( lParam1, lParam2, lParamSort );
+}
+int CompareProc (int lParam1, int lParam2, int lParamSort) {
     TreeItem item1 = items [lParam1], item2 = items [lParam2];
     char[] text1 = item1.getText (lParamSort), text2 = item2.getText (lParamSort);
-    return sortDirection is DWT.UP ? text1.compareTo (text2) : text2.compareTo (text1);
+    return sortDirection is DWT.UP ? ( text1 < text2 ) : ( text2 < text1 );
 }
 
 override public Point computeSize (int wHint, int hHint, bool changed) {
     checkWidget ();
     int width = 0, height = 0;
-    if (hwndHeader !is 0) {
-        HDITEM hdItem = new HDITEM ();
+    if (hwndHeader !is null) {
+        HDITEM hdItem;
         hdItem.mask = OS.HDI_WIDTH;
         int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
         for (int i=0; i<count; i++) {
-            OS.SendMessage (hwndHeader, OS.HDM_GETITEM, i, hdItem);
+            OS.SendMessage (hwndHeader, OS.HDM_GETITEM, i, &hdItem);
             width += hdItem.cxy;
         }
-        RECT rect = new RECT ();
-        OS.GetWindowRect (hwndHeader, rect);
+        RECT rect;
+        OS.GetWindowRect (hwndHeader, &rect);
         height += rect.bottom - rect.top;
     }
-    RECT rect = new RECT ();
-    int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
-    while (hItem !is 0) {
+    RECT rect;
+    HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
+    while (hItem !is null) {
         if ((style & DWT.VIRTUAL) is 0 && !painted) {
-            TVITEM tvItem = new TVITEM ();
+            TVITEM tvItem;
             tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_TEXT;
             tvItem.hItem = hItem;
             tvItem.pszText = OS.LPSTR_TEXTCALLBACK;
             ignoreCustomDraw = true;
-            OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
+            OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
             ignoreCustomDraw = false;
         }
-        rect.left = hItem;
-        if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, rect) !is 0) {
+        rect.left = cast(int) hItem;
+        if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, &rect) !is 0) {
             width = Math.max (width, rect.right);
             height += rect.bottom - rect.top;
         }
-        hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
+        hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
     }
     if (width is 0) width = DEFAULT_WIDTH;
     if (height is 0) height = DEFAULT_HEIGHT;
@@ -1854,7 +1862,7 @@
     if (EXPLORER_THEME) {
         if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
             explorerTheme = true;
-            OS.SetWindowTheme (handle, Display.EXPLORER, null);
+            OS.SetWindowTheme (handle, cast(TCHAR*) Display.EXPLORER, null);
             int bits = OS.TVS_EX_DOUBLEBUFFER | OS.TVS_EX_FADEINOUTEXPANDOS | OS.TVS_EX_RICHTOOLTIP;
             if ((style & DWT.FULL_SELECTION) is 0) bits |= OS.TVS_EX_AUTOHSCROLL;
             OS.SendMessage (handle, OS.TVM_SETEXTENDEDSTYLE, 0, bits);
@@ -1899,24 +1907,24 @@
     * The control will not destroy a font that it did not
     * create.
     */
-    int hFont = OS.GetStockObject (OS.SYSTEM_FONT);
+    HFONT hFont = OS.GetStockObject (OS.SYSTEM_FONT);
     OS.SendMessage (handle, OS.WM_SETFONT, hFont, 0);
 }
 
 void createHeaderToolTips () {
     if (OS.IsWinCE) return;
-    if (headerToolTipHandle !is 0) return;
+    if (headerToolTipHandle !is null) return;
     headerToolTipHandle = OS.CreateWindowEx (
         0,
-        new TCHAR (0, OS.TOOLTIPS_CLASS, true),
+        OS.TOOLTIPS_CLASS.ptr,
         null,
         0,
         OS.CW_USEDEFAULT, 0, OS.CW_USEDEFAULT, 0,
         handle,
-        0,
+        null,
         OS.GetModuleHandle (null),
         null);
-    if (headerToolTipHandle is 0) error (DWT.ERROR_NO_HANDLES);
+    if (headerToolTipHandle is null) error (DWT.ERROR_NO_HANDLES);
     /*
     * Feature in Windows.  Despite the fact that the
     * tool tip text contains \r\n, the tooltip will
@@ -1928,7 +1936,7 @@
 }
 
 void createItem (TreeColumn column, int index) {
-    if (hwndHeader is 0) createParent ();
+    if (hwndHeader is null) createParent ();
     int columnCount = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
     if (!(0 <= index && index <= columnCount)) error (DWT.ERROR_INVALID_RANGE);
     if (columnCount is columns.length) {
@@ -1984,11 +1992,11 @@
                 item.cellForeground = temp;
             }
             if (item.cellFont !is null) {
-                int [] cellFont = item.cellFont;
-                int [] temp = new int [columnCount + 1];
+                HFONT [] cellFont = item.cellFont;
+                HFONT [] temp = new HFONT [columnCount + 1];
                 System.arraycopy (cellFont, 0, temp, 0, index);
                 System.arraycopy (cellFont, index, temp, index + 1, columnCount- index);
-                temp [index] = -1;
+                temp [index] = cast(HFONT)-1;
                 item.cellFont = temp;
             }
         }
@@ -2002,16 +2010,16 @@
     * if is not possible to set the text at a later time.
     * The fix is to insert the item with an empty string.
     */
-    int hHeap = OS.GetProcessHeap ();
-    int pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, TCHAR.sizeof);
-    HDITEM hdItem = new HDITEM ();
+    auto hHeap = OS.GetProcessHeap ();
+    auto pszText = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, TCHAR.sizeof);
+    HDITEM hdItem;
     hdItem.mask = OS.HDI_TEXT | OS.HDI_FORMAT;
     hdItem.pszText = pszText;
     if ((column.style & DWT.LEFT) is DWT.LEFT) hdItem.fmt = OS.HDF_LEFT;
     if ((column.style & DWT.CENTER) is DWT.CENTER) hdItem.fmt = OS.HDF_CENTER;
     if ((column.style & DWT.RIGHT) is DWT.RIGHT) hdItem.fmt = OS.HDF_RIGHT;
-    OS.SendMessage (hwndHeader, OS.HDM_INSERTITEM, index, hdItem);
-    if (pszText !is 0) OS.HeapFree (hHeap, 0, pszText);
+    OS.SendMessage (hwndHeader, OS.HDM_INSERTITEM, index, &hdItem);
+    if (pszText !is null) OS.HeapFree (hHeap, 0, pszText);
 
     /* When the first column is created, hide the horizontal scroll bar */
     if (columnCount is 0) {
@@ -2040,20 +2048,20 @@
     }
 
     /* Add the tool tip item for the header */
-    if (headerToolTipHandle !is 0) {
-        RECT rect = new RECT ();
-        if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, rect) !is 0) {
-            TOOLINFO lpti = new TOOLINFO ();
+    if (headerToolTipHandle !is null) {
+        RECT rect;
+        if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, &rect) !is 0) {
+            TOOLINFO lpti;
             lpti.cbSize = TOOLINFO.sizeof;
             lpti.uFlags = OS.TTF_SUBCLASS;
             lpti.hwnd = hwndHeader;
             lpti.uId = column.id = display.nextToolTipId++;
-            lpti.left = rect.left;
-            lpti.top = rect.top;
-            lpti.right = rect.right;
-            lpti.bottom = rect.bottom;
+            lpti.rect.left = rect.left;
+            lpti.rect.top = rect.top;
+            lpti.rect.right = rect.right;
+            lpti.rect.bottom = rect.bottom;
             lpti.lpszText = OS.LPSTR_TEXTCALLBACK;
-            OS.SendMessage (headerToolTipHandle, OS.TTM_ADDTOOL, 0, lpti);
+            OS.SendMessage (headerToolTipHandle, OS.TTM_ADDTOOL, 0, &lpti);
         }
     }
 }
@@ -2083,26 +2091,26 @@
         }
         lastID = id + 1;
     }
-    int hNewItem = 0;
-    int hFirstItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, hParent);
-    bool fixParent = hFirstItem is 0;
-    if (hItem is 0) {
-        TVINSERTSTRUCT tvInsert = new TVINSERTSTRUCT ();
+    HANDLE hNewItem;
+    HANDLE hFirstItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, hParent);
+    bool fixParent = hFirstItem is null;
+    if (hItem is null) {
+        TVINSERTSTRUCT tvInsert;
         tvInsert.hParent = hParent;
         tvInsert.hInsertAfter = hInsertAfter;
-        tvInsert.lParam = id;
-        tvInsert.pszText = OS.LPSTR_TEXTCALLBACK;
-        tvInsert.iImage = tvInsert.iSelectedImage = OS.I_IMAGECALLBACK;
-        tvInsert.mask = OS.TVIF_TEXT | OS.TVIF_IMAGE | OS.TVIF_SELECTEDIMAGE | OS.TVIF_HANDLE | OS.TVIF_PARAM;
+        tvInsert.item.lParam = id;
+        tvInsert.item.pszText = OS.LPSTR_TEXTCALLBACK;
+        tvInsert.item.iImage = tvInsert.item.iSelectedImage = cast(HBITMAP) OS.I_IMAGECALLBACK;
+        tvInsert.item.mask = OS.TVIF_TEXT | OS.TVIF_IMAGE | OS.TVIF_SELECTEDIMAGE | OS.TVIF_HANDLE | OS.TVIF_PARAM;
         if ((style & DWT.CHECK) !is 0) {
-            tvInsert.mask = tvInsert.mask | OS.TVIF_STATE;
-            tvInsert.state = 1 << 12;
-            tvInsert.stateMask = OS.TVIS_STATEIMAGEMASK;
+            tvInsert.item.mask = tvInsert.item.mask | OS.TVIF_STATE;
+            tvInsert.item.state = 1 << 12;
+            tvInsert.item.stateMask = OS.TVIS_STATEIMAGEMASK;
         }
         ignoreCustomDraw = true;
-        hNewItem = OS.SendMessage (handle, OS.TVM_INSERTITEM, 0, tvInsert);
+        hNewItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_INSERTITEM, 0, &tvInsert);
         ignoreCustomDraw = false;
-        if (hNewItem is 0) error (DWT.ERROR_ITEM_NOT_ADDED);
+        if (hNewItem is null) error (DWT.ERROR_ITEM_NOT_ADDED);
         /*
         * This code is intentionally commented.
         */
@@ -2112,18 +2120,18 @@
 //          OS.SetWindowLong (handle, OS.GWL_STYLE, bits);
 //      }
     } else {
-        TVITEM tvItem = new TVITEM ();
+        TVITEM tvItem;
         tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM;
         tvItem.hItem = hNewItem = hItem;
         tvItem.lParam = id;
-        OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
+        OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
     }
     if (item !is null) {
         item.handle = hNewItem;
         items [id] = item;
     }
-    if (hFirstItem is 0) {
-        switch (hInsertAfter) {
+    if (hFirstItem is null) {
+        switch ( cast(int) hInsertAfter) {
             case OS.TVI_FIRST:
             case OS.TVI_LAST:
                 hFirstIndexOf = hLastIndexOf = hFirstItem = hNewItem;
@@ -2131,7 +2139,7 @@
         }
     }
     if (hFirstItem is hFirstIndexOf && itemCount !is -1) itemCount++;
-    if (hItem is 0) {
+    if (hItem is null) {
         /*
         * Bug in Windows.  When a child item is added to a parent item
         * that has no children outside of WM_NOTIFY with control code
@@ -2141,10 +2149,10 @@
         */
         if (fixParent) {
             if (drawCount is 0 && OS.IsWindowVisible (handle)) {
-                RECT rect = new RECT ();
-                rect.left = hParent;
-                if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, rect) !is 0) {
-                    OS.InvalidateRect (handle, rect, true);
+                RECT rect;
+                rect.left = cast(int) hParent;
+                if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, &rect) !is 0) {
+                    OS.InvalidateRect (handle, &rect, true);
                 }
             }
         }
@@ -2157,17 +2165,17 @@
         */
         if ((style & DWT.VIRTUAL) !is 0) {
             if (currentItem !is null) {
-                RECT rect = new RECT ();
-                rect.left = hNewItem;
-                if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, rect) !is 0) {
-                    RECT damageRect = new RECT ();
-                    bool damaged = OS.GetUpdateRect (handle, damageRect, true);
+                RECT rect;
+                rect.left = cast(int) hNewItem;
+                if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, &rect) !is 0) {
+                    RECT damageRect;
+                    bool damaged = cast(bool) OS.GetUpdateRect (handle, &damageRect, true);
                     if (damaged && damageRect.top < rect.bottom) {
                         if (OS.IsWinCE) {
-                            OS.OffsetRect (damageRect, 0, rect.bottom - rect.top);
-                            OS.InvalidateRect (handle, damageRect, true);
+                            OS.OffsetRect (&damageRect, 0, rect.bottom - rect.top);
+                            OS.InvalidateRect (handle, &damageRect, true);
                         } else {
-                            int rgn = OS.CreateRectRgn (0, 0, 0, 0);
+                            HRGN rgn = OS.CreateRectRgn (0, 0, 0, 0);
                             int result = OS.GetUpdateRgn (handle, rgn, true);
                             if (result !is OS.NULLREGION) {
                                 OS.OffsetRgn (rgn, 0, rect.bottom - rect.top);
@@ -2185,21 +2193,21 @@
 
 void createItemToolTips () {
     if (OS.IsWinCE) return;
-    if (itemToolTipHandle !is 0) return;
+    if (itemToolTipHandle !is null) return;
     int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
     bits |= OS.TVS_NOTOOLTIPS;
     OS.SetWindowLong (handle, OS.GWL_STYLE, bits);
     itemToolTipHandle = OS.CreateWindowEx (
         0,
-        new TCHAR (0, OS.TOOLTIPS_CLASS, true),
+        OS.TOOLTIPS_CLASS.ptr,
         null,
         0,
         OS.CW_USEDEFAULT, 0, OS.CW_USEDEFAULT, 0,
         handle,
-        0,
+        null,
         OS.GetModuleHandle (null),
         null);
-    if (itemToolTipHandle is 0) error (DWT.ERROR_NO_HANDLES);
+    if (itemToolTipHandle is null) error (DWT.ERROR_NO_HANDLES);
     /*
     * Feature in Windows.  Despite the fact that the
     * tool tip text contains \r\n, the tooltip will
@@ -2208,27 +2216,27 @@
     * a large value.
     */
     OS.SendMessage (itemToolTipHandle, OS.TTM_SETMAXTIPWIDTH, 0, 0x7FFF);
-    TOOLINFO lpti = new TOOLINFO ();
+    TOOLINFO lpti;
     lpti.cbSize = TOOLINFO.sizeof;
     lpti.hwnd = handle;
-    lpti.uId = handle;
+    lpti.uId = cast(int)handle;
     lpti.uFlags = OS.TTF_SUBCLASS | OS.TTF_TRANSPARENT;
     lpti.lpszText = OS.LPSTR_TEXTCALLBACK;
-    OS.SendMessage (itemToolTipHandle, OS.TTM_ADDTOOL, 0, lpti);
+    OS.SendMessage (itemToolTipHandle, OS.TTM_ADDTOOL, 0, &lpti);
 }
 
 void createParent () {
     forceResize ();
-    RECT rect = new RECT ();
-    OS.GetWindowRect (handle, rect);
-    OS.MapWindowPoints (0, parent.handle, rect, 2);
+    RECT rect;
+    OS.GetWindowRect (handle, &rect);
+    OS.MapWindowPoints (null, parent.handle, cast(POINT*) &rect, 2);
     int oldStyle = OS.GetWindowLong (handle, OS.GWL_STYLE);
     int newStyle = super.widgetStyle () & ~OS.WS_VISIBLE;
     if ((oldStyle & OS.WS_DISABLED) !is 0) newStyle |= OS.WS_DISABLED;
 //  if ((oldStyle & OS.WS_VISIBLE) !is 0) newStyle |= OS.WS_VISIBLE;
     hwndParent = OS.CreateWindowEx (
         super.widgetExtStyle (),
-        super.windowClass (),
+        StrToTCHARz( 0, super.windowClass () ),
         null,
         newStyle,
         rect.left,
@@ -2236,11 +2244,11 @@
         rect.right - rect.left,
         rect.bottom - rect.top,
         parent.handle,
-        0,
+        null,
         OS.GetModuleHandle (null),
         null);
-    if (hwndParent is 0) error (DWT.ERROR_NO_HANDLES);
-    OS.SetWindowLong (hwndParent, OS.GWL_ID, hwndParent);
+    if (hwndParent is null) error (DWT.ERROR_NO_HANDLES);
+    OS.SetWindowLong (hwndParent, OS.GWL_ID, cast(int) hwndParent);
     int bits = 0;
     if (OS.WIN32_VERSION >= OS.VERSION (4, 10)) {
         bits |= OS.WS_EX_NOINHERITLAYOUT;
@@ -2248,18 +2256,18 @@
     }
     hwndHeader = OS.CreateWindowEx (
         bits,
-        HeaderClass,
+        HeaderClass.ptr,
         null,
         OS.HDS_BUTTONS | OS.HDS_FULLDRAG | OS.HDS_DRAGDROP | OS.HDS_HIDDEN | OS.WS_CHILD | OS.WS_CLIPSIBLINGS,
         0, 0, 0, 0,
         hwndParent,
-        0,
+        null,
         OS.GetModuleHandle (null),
         null);
-    if (hwndHeader is 0) error (DWT.ERROR_NO_HANDLES);
-    OS.SetWindowLong (hwndHeader, OS.GWL_ID, hwndHeader);
+    if (hwndHeader is null) error (DWT.ERROR_NO_HANDLES);
+    OS.SetWindowLong (hwndHeader, OS.GWL_ID, cast(int) hwndHeader);
     if (OS.IsDBLocale) {
-        int hIMC = OS.ImmGetContext (handle);
+        auto hIMC = OS.ImmGetContext (handle);
         OS.ImmAssociateContext (hwndParent, hIMC);
         OS.ImmAssociateContext (hwndHeader, hIMC);
         OS.ImmReleaseContext (handle, hIMC);
@@ -2272,26 +2280,26 @@
 //          OS.SetWindowLong (handle, OS.GWL_EXSTYLE, oldExStyle);
 //      }
 //  }
-    int hFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
-    if (hFont !is 0) OS.SendMessage (hwndHeader, OS.WM_SETFONT, hFont, 0);
-    int hwndInsertAfter = OS.GetWindow (handle, OS.GW_HWNDPREV);
+    HFONT hFont = cast(HFONT) OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
+    if (hFont !is null) OS.SendMessage (hwndHeader, OS.WM_SETFONT, hFont, 0);
+    HANDLE hwndInsertAfter = OS.GetWindow (handle, OS.GW_HWNDPREV);
     int flags = OS.SWP_NOSIZE | OS.SWP_NOMOVE | OS.SWP_NOACTIVATE;
     SetWindowPos (hwndParent, hwndInsertAfter, 0, 0, 0, 0, flags);
-    SCROLLINFO info = new SCROLLINFO ();
+    SCROLLINFO info;
     info.cbSize = SCROLLINFO.sizeof;
     info.fMask = OS.SIF_RANGE | OS.SIF_PAGE;
-    OS.GetScrollInfo (hwndParent, OS.SB_HORZ, info);
+    OS.GetScrollInfo (hwndParent, OS.SB_HORZ, &info);
     info.nPage = info.nMax + 1;
-    OS.SetScrollInfo (hwndParent, OS.SB_HORZ, info, true);
-    OS.GetScrollInfo (hwndParent, OS.SB_VERT, info);
+    OS.SetScrollInfo (hwndParent, OS.SB_HORZ, &info, true);
+    OS.GetScrollInfo (hwndParent, OS.SB_VERT, &info);
     info.nPage = info.nMax + 1;
-    OS.SetScrollInfo (hwndParent, OS.SB_VERT, info, true);
+    OS.SetScrollInfo (hwndParent, OS.SB_VERT, &info, true);
     customDraw = true;
     deregister ();
     if ((oldStyle & OS.WS_VISIBLE) !is 0) {
         OS.ShowWindow (hwndParent, OS.SW_SHOW);
     }
-    int hwndFocus = OS.GetFocus ();
+    HWND hwndFocus = OS.GetFocus ();
     if (hwndFocus is handle) OS.SetFocus (hwndParent);
     OS.SetParent (handle, hwndParent);
     if (hwndFocus is handle) OS.SetFocus (handle);
@@ -2313,19 +2321,19 @@
 
 override void deregister () {
     super.deregister ();
-    if (hwndParent !is 0) display.removeControl (hwndParent);
-    if (hwndHeader !is 0) display.removeControl (hwndHeader);
-}
-
-void deselect (int hItem, TVITEM tvItem, int hIgnoreItem) {
-    while (hItem !is 0) {
+    if (hwndParent !is null) display.removeControl (hwndParent);
+    if (hwndHeader !is null) display.removeControl (hwndHeader);
+}
+
+void deselect (HANDLE hItem, TVITEM* tvItem, HANDLE hIgnoreItem) {
+    while (hItem !is null) {
         if (hItem !is hIgnoreItem) {
             tvItem.hItem = hItem;
             OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
         }
-        int hFirstItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, hItem);
+        auto hFirstItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, hItem);
         deselect (hFirstItem, tvItem, hIgnoreItem);
-        hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
+        hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
     }
 }
 
@@ -2339,27 +2347,27 @@
  */
 public void deselectAll () {
     checkWidget ();
-    TVITEM tvItem = new TVITEM ();
+    TVITEM tvItem;
     tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_STATE;
     tvItem.stateMask = OS.TVIS_SELECTED;
     if ((style & DWT.SINGLE) !is 0) {
-        int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
-        if (hItem !is 0) {
+        HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
+        if (hItem !is null) {
             tvItem.hItem = hItem;
-            OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
+            OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
         }
     } else {
         int oldProc = OS.GetWindowLong (handle, OS.GWL_WNDPROC);
-        OS.SetWindowLong (handle, OS.GWL_WNDPROC, TreeProc);
+        OS.SetWindowLong (handle, OS.GWL_WNDPROC, cast(int) TreeProc);
         if ((style & DWT.VIRTUAL) !is 0) {
-            int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
-            deselect (hItem, tvItem, 0);
+            HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
+            deselect (hItem, &tvItem, null);
         } else {
             for (int i=0; i<items.length; i++) {
                 TreeItem item = items [i];
                 if (item !is null) {
                     tvItem.hItem = item.handle;
-                    OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
+                    OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
                 }
             }
         }
@@ -2368,7 +2376,7 @@
 }
 
 void destroyItem (TreeColumn column) {
-    if (hwndHeader is 0) error (DWT.ERROR_ITEM_NOT_REMOVED);
+    if (hwndHeader is null) error (DWT.ERROR_ITEM_NOT_REMOVED);
     int columnCount = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
     int index = 0;
     while (index < columnCount) {
@@ -2376,14 +2384,14 @@
         index++;
     }
     int [] oldOrder = new int [columnCount];
-    OS.SendMessage (hwndHeader, OS.HDM_GETORDERARRAY, columnCount, oldOrder);
+    OS.SendMessage (hwndHeader, OS.HDM_GETORDERARRAY, columnCount, oldOrder.ptr);
     int orderIndex = 0;
     while (orderIndex < columnCount) {
         if (oldOrder [orderIndex] is index) break;
         orderIndex++;
     }
-    RECT headerRect = new RECT ();
-    OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, headerRect);
+    RECT headerRect;
+    OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, &headerRect);
     if (OS.SendMessage (hwndHeader, OS.HDM_DELETEITEM, index, 0) is 0) {
         error (DWT.ERROR_ITEM_NOT_REMOVED);
     }
@@ -2436,8 +2444,8 @@
                     item.cellForeground = temp;
                 }
                 if (item.cellFont !is null) {
-                    int [] cellFont = item.cellFont;
-                    int [] temp = new int [columnCount];
+                    HFONT [] cellFont = item.cellFont;
+                    HFONT [] temp = new HFONT [columnCount];
                     System.arraycopy (cellFont, 0, temp, 0, index);
                     System.arraycopy (cellFont, index + 1, temp, index, columnCount - index);
                     item.cellFont = temp;
@@ -2463,24 +2471,24 @@
         if (index is 0) {
             columns [0].style &= ~(DWT.LEFT | DWT.RIGHT | DWT.CENTER);
             columns [0].style |= DWT.LEFT;
-            HDITEM hdItem = new HDITEM ();
+            HDITEM hdItem;
             hdItem.mask = OS.HDI_FORMAT | OS.HDI_IMAGE;
-            OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, hdItem);
+            OS.SendMessage (hwndHeader, OS.HDM_GETITEM, index, &hdItem);
             hdItem.fmt &= ~OS.HDF_JUSTIFYMASK;
             hdItem.fmt |= OS.HDF_LEFT;
-            OS.SendMessage (hwndHeader, OS.HDM_SETITEM, index, hdItem);
-        }
-        RECT rect = new RECT ();
-        OS.GetClientRect (handle, rect);
+            OS.SendMessage (hwndHeader, OS.HDM_SETITEM, index, &hdItem);
+        }
+        RECT rect;
+        OS.GetClientRect (handle, &rect);
         rect.left = headerRect.left;
-        OS.InvalidateRect (handle, rect, true);
+        OS.InvalidateRect (handle, &rect, true);
     }
     setScrollWidth ();
     updateImageList ();
     updateScrollBar ();
     if (columnCount !is 0) {
         int [] newOrder = new int [columnCount];
-        OS.SendMessage (hwndHeader, OS.HDM_GETORDERARRAY, columnCount, newOrder);
+        OS.SendMessage (hwndHeader, OS.HDM_GETORDERARRAY, columnCount, newOrder.ptr);
         TreeColumn [] newColumns = new TreeColumn [columnCount - orderIndex];
         for (int i=orderIndex; i<newOrder.length; i++) {
             newColumns [i - orderIndex] = columns [newOrder [i]];
@@ -2494,17 +2502,17 @@
     }
 
     /* Remove the tool tip item for the header */
-    if (headerToolTipHandle !is 0) {
-        TOOLINFO lpti = new TOOLINFO ();
+    if (headerToolTipHandle !is null) {
+        TOOLINFO lpti;
         lpti.cbSize = TOOLINFO.sizeof;
         lpti.uId = column.id;
         lpti.hwnd = hwndHeader;
-        OS.SendMessage (headerToolTipHandle, OS.TTM_DELTOOL, 0, lpti);
+        OS.SendMessage (headerToolTipHandle, OS.TTM_DELTOOL, 0, &lpti);
     }
 }
 
 void destroyItem (TreeItem item, HANDLE hItem) {
-    hFirstIndexOf = hLastIndexOf = 0;
+    hFirstIndexOf = hLastIndexOf = null;
     itemCount = -1;
     /*
     * Feature in Windows.  When an item is removed that is not
@@ -2521,17 +2529,17 @@
     * allowing application code to add or remove items during
     * this remove operation.
     */
-    int hParent = 0;
+    HANDLE hParent;
     bool fixRedraw = false;
     if ((style & DWT.DOUBLE_BUFFERED) is 0) {
         if (drawCount is 0 && OS.IsWindowVisible (handle)) {
-            RECT rect = new RECT ();
-            rect.left = hItem;
-            fixRedraw = OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, rect) is 0;
+            RECT rect;
+            rect.left = cast(int) hItem;
+            fixRedraw = OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, &rect) is 0;
         }
     }
     if (fixRedraw) {
-        hParent = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_PARENT, hItem);
+        hParent = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_PARENT, hItem);
         OS.UpdateWindow (handle);
         OS.DefWindowProc (handle, OS.WM_SETREDRAW, 0, 0);
         /*
@@ -2554,8 +2562,8 @@
     * NOTE:  This only happens on Vista.
     */
     if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
-        int hwndToolTip = OS.SendMessage (handle, OS.TVM_GETTOOLTIPS, 0, 0);
-        if (hwndToolTip !is 0) OS.SendMessage (hwndToolTip, OS.TTM_POP, 0 ,0);
+        auto hwndToolTip = cast(HWND) OS.SendMessage (handle, OS.TVM_GETTOOLTIPS, 0, 0);
+        if (hwndToolTip !is null) OS.SendMessage (hwndToolTip, OS.TTM_POP, 0 ,0);
     }
 
     shrink = ignoreShrink = true;
@@ -2572,10 +2580,10 @@
         * is visible, redraw the parent item to force the + / - to be updated.
         */
         if (OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, hParent) is 0) {
-            RECT rect = new RECT ();
-            rect.left = hParent;
-            if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, rect) !is 0) {
-                OS.InvalidateRect (handle, rect, true);
+            RECT rect;
+            rect.left = cast(int) hParent;
+            if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, &rect) !is 0) {
+                OS.InvalidateRect (handle, &rect, true);
             }
         }
     }
@@ -2586,7 +2594,7 @@
             display.releaseImageList (imageList);
         }
         imageList = null;
-        if (hwndParent is 0 && !linesVisible) {
+        if (hwndParent is null && !linesVisible) {
             if (!hooks (DWT.MeasureItem) && !hooks (DWT.EraseItem) && !hooks (DWT.PaintItem)) {
                 customDraw = false;
             }
@@ -2633,7 +2641,7 @@
             _setBackgroundPixel (enabled ? control.getBackgroundPixel () : -1);
         }
     }
-    if (hwndParent !is 0) OS.EnableWindow (hwndParent, enabled);
+    if (hwndParent !is null) OS.EnableWindow (hwndParent, enabled);
 
     /*
     * Feature in Windows.  When the tree has the style
@@ -2647,26 +2655,26 @@
 }
 
 int findIndex (HANDLE hFirstItem, HANDLE hItem) {
-    if (hFirstItem is 0) return -1;
+    if (hFirstItem is null) return -1;
     if (hFirstItem is hFirstIndexOf) {
         if (hFirstIndexOf is hItem) {
             hLastIndexOf = hFirstIndexOf;
             return lastIndexOf = 0;
         }
         if (hLastIndexOf is hItem) return lastIndexOf;
-        int hPrevItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_PREVIOUS, hLastIndexOf);
+        auto hPrevItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_PREVIOUS, hLastIndexOf);
         if (hPrevItem is hItem) {
             hLastIndexOf = hPrevItem;
             return --lastIndexOf;
         }
-        int hNextItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hLastIndexOf);
+        HANDLE hNextItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hLastIndexOf);
         if (hNextItem is hItem) {
             hLastIndexOf = hNextItem;
             return ++lastIndexOf;
         }
         int previousIndex = lastIndexOf - 1;
-        while (hPrevItem !is 0 && hPrevItem !is hItem) {
-            hPrevItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_PREVIOUS, hPrevItem);
+        while (hPrevItem !is null && hPrevItem !is hItem) {
+            hPrevItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_PREVIOUS, hPrevItem);
             --previousIndex;
         }
         if (hPrevItem is hItem) {
@@ -2674,8 +2682,8 @@
             return lastIndexOf = previousIndex;
         }
         int nextIndex = lastIndexOf + 1;
-        while (hNextItem !is 0 && hNextItem !is hItem) {
-            hNextItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hNextItem);
+        while (hNextItem !is null && hNextItem !is hItem) {
+            hNextItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hNextItem);
             nextIndex++;
         }
         if (hNextItem is hItem) {
@@ -2684,9 +2692,10 @@
         }
         return -1;
     }
-    int index = 0, hNextItem = hFirstItem;
-    while (hNextItem !is 0 && hNextItem !is hItem) {
-        hNextItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hNextItem);
+    int index = 0;
+    auto hNextItem = hFirstItem;
+    while (hNextItem !is null && hNextItem !is hItem) {
+        hNextItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hNextItem);
         index++;
     }
     if (hNextItem is hItem) {
@@ -2703,7 +2712,7 @@
 }
 
 HANDLE findItem (HANDLE hFirstItem, int index) {
-    if (hFirstItem is 0) return 0;
+    if (hFirstItem is null) return null;
     if (hFirstItem is hFirstIndexOf) {
         if (index is 0) {
             lastIndexOf = 0;
@@ -2712,17 +2721,17 @@
         if (lastIndexOf is index) return hLastIndexOf;
         if (lastIndexOf - 1 is index) {
             --lastIndexOf;
-            return hLastIndexOf = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_PREVIOUS, hLastIndexOf);
+            return hLastIndexOf = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_PREVIOUS, hLastIndexOf);
         }
         if (lastIndexOf + 1 is index) {
             lastIndexOf++;
-            return hLastIndexOf = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hLastIndexOf);
+            return hLastIndexOf = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hLastIndexOf);
         }
         if (index < lastIndexOf) {
             int previousIndex = lastIndexOf - 1;
-            int hPrevItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_PREVIOUS, hLastIndexOf);
-            while (hPrevItem !is 0 && index < previousIndex) {
-                hPrevItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_PREVIOUS, hPrevItem);
+            auto hPrevItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_PREVIOUS, hLastIndexOf);
+            while (hPrevItem !is null && index < previousIndex) {
+                hPrevItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_PREVIOUS, hPrevItem);
                 --previousIndex;
             }
             if (index is previousIndex) {
@@ -2731,9 +2740,9 @@
             }
         } else {
             int nextIndex = lastIndexOf + 1;
-            int hNextItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hLastIndexOf);
-            while (hNextItem !is 0 && nextIndex < index) {
-                hNextItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hNextItem);
+            auto hNextItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hLastIndexOf);
+            while (hNextItem !is null && nextIndex < index) {
+                hNextItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hNextItem);
                 nextIndex++;
             }
             if (index is nextIndex) {
@@ -2741,11 +2750,12 @@
                 return hLastIndexOf = hNextItem;
             }
         }
-        return 0;
-    }
-    int nextIndex = 0, hNextItem = hFirstItem;
-    while (hNextItem !is 0 && nextIndex < index) {
-        hNextItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hNextItem);
+        return null;
+    }
+    int nextIndex = 0;
+    auto hNextItem = hFirstItem;
+    while (hNextItem !is null && nextIndex < index) {
+        hNextItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hNextItem);
         nextIndex++;
     }
     if (index is nextIndex) {
@@ -2754,13 +2764,13 @@
         hFirstIndexOf = hFirstItem;
         return hLastIndexOf = hNextItem;
     }
-    return 0;
+    return null;
 }
 
 TreeItem getFocusItem () {
 //  checkWidget ();
-    int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
-    return hItem !is 0 ? _getItem (hItem) : null;
+    HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
+    return hItem !is null ? _getItem (hItem) : null;
 }
 
 /**
@@ -2794,9 +2804,9 @@
  */
 public int getHeaderHeight () {
     checkWidget ();
-    if (hwndHeader is 0) return 0;
-    RECT rect = new RECT ();
-    OS.GetWindowRect (hwndHeader, rect);
+    if (hwndHeader is null) return 0;
+    RECT rect;
+    OS.GetWindowRect (hwndHeader, &rect);
     return rect.bottom - rect.top;
 }
 
@@ -2821,7 +2831,7 @@
  */
 public bool getHeaderVisible () {
     checkWidget ();
-    if (hwndHeader is 0) return false;
+    if (hwndHeader is null) return false;
     int bits = OS.GetWindowLong (hwndHeader, OS.GWL_STYLE);
     return (bits & OS.WS_VISIBLE) !is 0;
 }
@@ -2831,13 +2841,13 @@
     return new Point (0, getItemHeight ());
 }
 
-int getBottomItem () {
-    int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0);
-    if (hItem is 0) return 0;
+HANDLE getBottomItem () {
+    HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0);
+    if (hItem is null) return null;
     int index = 0, count = OS.SendMessage (handle, OS.TVM_GETVISIBLECOUNT, 0, 0);
     while (index < count) {
-        int hNextItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXTVISIBLE, hItem);
-        if (hNextItem is 0) return hItem;
+        HANDLE hNextItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXTVISIBLE, hItem);
+        if (hNextItem is null) return hItem;
         hItem = hNextItem;
         index++;
     }
@@ -2875,7 +2885,7 @@
  */
 public TreeColumn getColumn (int index) {
     checkWidget ();
-    if (hwndHeader is 0) error (DWT.ERROR_INVALID_RANGE);
+    if (hwndHeader is null) error (DWT.ERROR_INVALID_RANGE);
     int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
     if (!(0 <= index && index < count)) error (DWT.ERROR_INVALID_RANGE);
     return columns [index];
@@ -2899,7 +2909,7 @@
  */
 public int getColumnCount () {
     checkWidget ();
-    if (hwndHeader is 0) return 0;
+    if (hwndHeader is null) return 0;
     return OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
 }
 
@@ -2933,10 +2943,10 @@
  */
 public int[] getColumnOrder () {
     checkWidget ();
-    if (hwndHeader is 0) return new int [0];
+    if (hwndHeader is null) return new int [0];
     int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
     int [] order = new int [count];
-    OS.SendMessage (hwndHeader, OS.HDM_GETORDERARRAY, count, order);
+    OS.SendMessage (hwndHeader, OS.HDM_GETORDERARRAY, count, order.ptr);
     return order;
 }
 
@@ -2971,7 +2981,7 @@
  */
 public TreeColumn [] getColumns () {
     checkWidget ();
-    if (hwndHeader is 0) return new TreeColumn [0];
+    if (hwndHeader is null) return new TreeColumn [0];
     int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
     TreeColumn [] result = new TreeColumn [count];
     System.arraycopy (columns, 0, result, 0, count);
@@ -2998,14 +3008,14 @@
 public TreeItem getItem (int index) {
     checkWidget ();
     if (index < 0) error (DWT.ERROR_INVALID_RANGE);
-    int hFirstItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
-    if (hFirstItem is 0) error (DWT.ERROR_INVALID_RANGE);
-    int hItem = findItem (hFirstItem, index);
-    if (hItem is 0) error (DWT.ERROR_INVALID_RANGE);
+    auto hFirstItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
+    if (hFirstItem is null) error (DWT.ERROR_INVALID_RANGE);
+    HANDLE hItem = findItem (hFirstItem, index);
+    if (hItem is null) error (DWT.ERROR_INVALID_RANGE);
     return _getItem (hItem);
 }
 
-TreeItem getItem (NMTVCUSTOMDRAW nmcd) {
+TreeItem getItem (NMTVCUSTOMDRAW* nmcd) {
     /*
     * Bug in Windows.  If the lParam field of TVITEM
     * is changed during custom draw using TVM_SETITEM,
@@ -3014,17 +3024,17 @@
     * fix is to query the field from the item instead
     * of using the struct.
     */
-    int id = nmcd.lItemlParam;
+    int id = nmcd.nmcd.lItemlParam;
     if ((style & DWT.VIRTUAL) !is 0) {
         if (id is -1) {
-            TVITEM tvItem = new TVITEM ();
+            TVITEM tvItem;
             tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM;
-            tvItem.hItem = nmcd.dwItemSpec;
-            OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
+            tvItem.hItem = cast(HANDLE) nmcd.nmcd.dwItemSpec;
+            OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem);
             id = tvItem.lParam;
         }
     }
-    return _getItem (nmcd.dwItemSpec, id);
+    return _getItem (cast(HANDLE) nmcd.nmcd.dwItemSpec, id);
 }
 
 /**
@@ -3053,11 +3063,11 @@
 public TreeItem getItem (Point point) {
     checkWidget ();
     if (point is null) error (DWT.ERROR_NULL_ARGUMENT);
-    TVHITTESTINFO lpht = new TVHITTESTINFO ();
-    lpht.x = point.x;
-    lpht.y = point.y;
-    OS.SendMessage (handle, OS.TVM_HITTEST, 0, lpht);
-    if (lpht.hItem !is 0) {
+    TVHITTESTINFO lpht;
+    lpht.pt.x = point.x;
+    lpht.pt.y = point.y;
+    OS.SendMessage (handle, OS.TVM_HITTEST, 0, &lpht);
+    if (lpht.hItem !is null) {
         if ((style & DWT.FULL_SELECTION) !is 0 || (lpht.flags & OS.TVHT_ONITEM) !is 0) {
             return _getItem (lpht.hItem);
         }
@@ -3080,20 +3090,21 @@
  */
 public int getItemCount () {
     checkWidget ();
-    int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
-    if (hItem is 0) return 0;
+    HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
+    if (hItem is null) return 0;
     return getItemCount (hItem);
 }
 
 int getItemCount (HANDLE hItem) {
-    int count = 0, hFirstItem = hItem;
+    int count = 0;
+    auto hFirstItem = hItem;
     if (hItem is hFirstIndexOf) {
         if (itemCount !is -1) return itemCount;
         hFirstItem = hLastIndexOf;
         count = lastIndexOf;
     }
-    while (hFirstItem !is 0) {
-        hFirstItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hFirstItem);
+    while (hFirstItem !is null) {
+        hFirstItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hFirstItem);
         count++;
     }
     if (hItem is hFirstIndexOf) itemCount = count;
@@ -3135,20 +3146,21 @@
  */
 public TreeItem [] getItems () {
     checkWidget ();
-    int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
-    if (hItem is 0) return new TreeItem [0];
+    HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
+    if (hItem is null) return null;
     return getItems (hItem);
 }
 
-TreeItem [] getItems (int hTreeItem) {
-    int count = 0, hItem = hTreeItem;
-    while (hItem !is 0) {
-        hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
+TreeItem [] getItems (HANDLE hTreeItem) {
+    int count = 0;
+    auto hItem = hTreeItem;
+    while (hItem !is null) {
+        hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
         count++;
     }
     int index = 0;
     TreeItem [] result = new TreeItem [count];
-    TVITEM tvItem = new TVITEM ();
+    TVITEM tvItem;
     tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM;
     tvItem.hItem = hTreeItem;
     /*
@@ -3158,11 +3170,11 @@
     * been deleted from the tree.  The fix is to check for null items and
     * remove them from the list.
     */
-    while (tvItem.hItem !is 0) {
-        OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
+    while (tvItem.hItem !is null) {
+        OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem);
         TreeItem item = _getItem (tvItem.hItem, tvItem.lParam);
         if (item !is null) result [index++] = item;
-        tvItem.hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, tvItem.hItem);
+        tvItem.hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, tvItem.hItem);
     }
     if (index !is count) {
         TreeItem [] newResult = new TreeItem [index];
@@ -3196,10 +3208,10 @@
     return linesVisible;
 }
 
-int getNextSelection (int hItem, TVITEM tvItem) {
-    while (hItem !is 0) {
+HANDLE getNextSelection (HANDLE hItem, TVITEM* tvItem) {
+    while (hItem !is null) {
         int state = 0;
-        if (OS.IsWinCE) {
+        static if (OS.IsWinCE) {
             tvItem.hItem = hItem;
             OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
             state = tvItem.state;
@@ -3207,12 +3219,12 @@
             state = OS.SendMessage (handle, OS.TVM_GETITEMSTATE, hItem, OS.TVIS_SELECTED);
         }
         if ((state & OS.TVIS_SELECTED) !is 0) return hItem;
-        int hFirstItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, hItem);
-        int hSelected = getNextSelection (hFirstItem, tvItem);
-        if (hSelected !is 0) return hSelected;
-        hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
-    }
-    return 0;
+        auto hFirstItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, hItem);
+        auto hSelected = getNextSelection (hFirstItem, tvItem);
+        if (hSelected !is null) return hSelected;
+        hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
+    }
+    return null;
 }
 
 /**
@@ -3232,8 +3244,8 @@
     return null;
 }
 
-int getSelection (int hItem, TVITEM tvItem, TreeItem [] selection, int index, int count, bool bigSelection, bool all) {
-    while (hItem !is 0) {
+int getSelection (HANDLE hItem, TVITEM* tvItem, TreeItem [] selection, int index, int count, bool bigSelection, bool all) {
+    while (hItem !is null) {
         if (OS.IsWinCE || bigSelection) {
             tvItem.hItem = hItem;
             OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
@@ -3256,13 +3268,13 @@
         }
         if (index is count) break;
         if (all) {
-            int hFirstItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, hItem);
+            auto hFirstItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, hItem);
             if ((index = getSelection (hFirstItem, tvItem, selection, index, count, bigSelection, all)) is count) {
                 break;
             }
-            hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
+            hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
         } else {
-            hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXTVISIBLE, hItem);
+            hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXTVISIBLE, hItem);
         }
     }
     return index;
@@ -3287,37 +3299,38 @@
 public TreeItem [] getSelection () {
     checkWidget ();
     if ((style & DWT.SINGLE) !is 0) {
-        int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
-        if (hItem is 0) return new TreeItem [0];
-        TVITEM tvItem = new TVITEM ();
+        HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
+        if (hItem is null) return new TreeItem [0];
+        TVITEM tvItem;
         tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM | OS.TVIF_STATE;
         tvItem.hItem = hItem;
-        OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
+        OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem);
         if ((tvItem.state & OS.TVIS_SELECTED) is 0) return new TreeItem [0];
         return [_getItem (tvItem.hItem, tvItem.lParam)];
     }
     int count = 0;
     TreeItem [] guess = new TreeItem [(style & DWT.VIRTUAL) !is 0 ? 8 : 1];
     int oldProc = OS.GetWindowLong (handle, OS.GWL_WNDPROC);
-    OS.SetWindowLong (handle, OS.GWL_WNDPROC, TreeProc);
+    OS.SetWindowLong (handle, OS.GWL_WNDPROC, cast(int) TreeProc);
     if ((style & DWT.VIRTUAL) !is 0) {
-        TVITEM tvItem = new TVITEM ();
+        TVITEM tvItem;
         tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM | OS.TVIF_STATE;
-        int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
-        count = getSelection (hItem, tvItem, guess, 0, -1, false, true);
+        HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
+        count = getSelection (hItem, &tvItem, guess, 0, -1, false, true);
     } else {
-        TVITEM tvItem = null;
-        if (OS.IsWinCE) {
-            tvItem = new TVITEM ();
+        TVITEM tvItem;
+        static if (OS.IsWinCE) {
+            //tvItem = new TVITEM ();
             tvItem.mask = OS.TVIF_STATE;
         }
         for (int i=0; i<items.length; i++) {
             TreeItem item = items [i];
             if (item !is null) {
-                int hItem = item.handle, state = 0;
-                if (OS.IsWinCE) {
+                HANDLE hItem = item.handle;
+                int state = 0;
+                static if (OS.IsWinCE) {
                     tvItem.hItem = hItem;
-                    OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
+                    OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem);
                     state = tvItem.state;
                 } else {
                     state = OS.SendMessage (handle, OS.TVM_GETITEMSTATE, hItem, OS.TVIS_SELECTED);
@@ -3337,14 +3350,14 @@
         System.arraycopy (guess, 0, result, 0, count);
         return result;
     }
-    OS.SetWindowLong (handle, OS.GWL_WNDPROC, TreeProc);
-    TVITEM tvItem = new TVITEM ();
+    OS.SetWindowLong (handle, OS.GWL_WNDPROC, cast(int) TreeProc);
+    TVITEM tvItem;
     tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM | OS.TVIF_STATE;
-    int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
+    HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
     int itemCount = OS.SendMessage (handle, OS.TVM_GETCOUNT, 0, 0);
     bool bigSelection = result.length > itemCount / 2;
-    if (count !is getSelection (hItem, tvItem, result, 0, count, bigSelection, false)) {
-        getSelection (hItem, tvItem, result, 0, count, bigSelection, true);
+    if (count !is getSelection (hItem, &tvItem, result, 0, count, bigSelection, false)) {
+        getSelection (hItem, &tvItem, result, 0, count, bigSelection, true);
     }
     OS.SetWindowLong (handle, OS.GWL_WNDPROC, oldProc);
     return result;
@@ -3363,14 +3376,14 @@
 public int getSelectionCount () {
     checkWidget ();
     if ((style & DWT.SINGLE) !is 0) {
-        int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
-        if (hItem is 0) return 0;
+        HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
+        if (hItem is null) return 0;
         int state = 0;
         if (OS.IsWinCE) {
-            TVITEM tvItem = new TVITEM ();
+            TVITEM tvItem;
             tvItem.hItem = hItem;
             tvItem.mask = OS.TVIF_STATE;
-            OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
+            OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem);
             state = tvItem.state;
         } else {
             state = OS.SendMessage (handle, OS.TVM_GETITEMSTATE, hItem, OS.TVIS_SELECTED);
@@ -3379,21 +3392,23 @@
     }
     int count = 0;
     int oldProc = OS.GetWindowLong (handle, OS.GWL_WNDPROC);
-    TVITEM tvItem = null;
-    if (OS.IsWinCE) {
-        tvItem = new TVITEM ();
+    TVITEM tvItem_;
+    TVITEM* tvItem = null;
+    static if (OS.IsWinCE) {
+        tvItem = &tvitem_;
         tvItem.mask = OS.TVIF_STATE;
     }
-    OS.SetWindowLong (handle, OS.GWL_WNDPROC, TreeProc);
+    OS.SetWindowLong (handle, OS.GWL_WNDPROC, cast(int) TreeProc);
     if ((style & DWT.VIRTUAL) !is 0) {
-        int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
+        HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
         count = getSelection (hItem, tvItem, null, 0, -1, false, true);
     } else {
         for (int i=0; i<items.length; i++) {
             TreeItem item = items [i];
             if (item !is null) {
-                int hItem = item.handle, state = 0;
-                if (OS.IsWinCE) {
+                auto hItem = item.handle;
+                int state = 0;
+                static if (OS.IsWinCE) {
                     tvItem.hItem = hItem;
                     OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
                     state = tvItem.state;
@@ -3483,8 +3498,8 @@
  */
 public TreeItem getTopItem () {
     checkWidget ();
-    int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0);
-    return hItem !is 0 ? _getItem (hItem) : null;
+    HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0);
+    return hItem !is null ? _getItem (hItem) : null;
 }
 
 int imageIndex (Image image, int index) {
@@ -3495,9 +3510,9 @@
     }
     int imageIndex = imageList.indexOf (image);
     if (imageIndex is -1) imageIndex = imageList.add (image);
-    if (hwndHeader is 0 || OS.SendMessage (hwndHeader, OS.HDM_ORDERTOINDEX, 0, 0) is index) {
-        int hImageList = imageList.getHandle ();
-        int hOldImageList = OS.SendMessage (handle, OS.TVM_GETIMAGELIST, OS.TVSIL_NORMAL, 0);
+    if (hwndHeader is null || OS.SendMessage (hwndHeader, OS.HDM_ORDERTOINDEX, 0, 0) is index) {
+        auto hImageList = imageList.getHandle ();
+        auto hOldImageList = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETIMAGELIST, OS.TVSIL_NORMAL, 0);
         if (hOldImageList !is hImageList) {
             OS.SendMessage (handle, OS.TVM_SETIMAGELIST, OS.TVSIL_NORMAL, hImageList);
             updateScrollBar ();
@@ -3513,8 +3528,8 @@
         headerImageList = display.getImageList (style & DWT.RIGHT_TO_LEFT, bounds.width, bounds.height);
         int index = headerImageList.indexOf (image);
         if (index is -1) index = headerImageList.add (image);
-        int hImageList = headerImageList.getHandle ();
-        if (hwndHeader !is 0) {
+        auto hImageList = headerImageList.getHandle ();
+        if (hwndHeader !is null) {
             OS.SendMessage (hwndHeader, OS.HDM_SETIMAGELIST, 0, hImageList);
         }
         updateScrollBar ();
@@ -3548,7 +3563,7 @@
     checkWidget ();
     if (column is null) error (DWT.ERROR_NULL_ARGUMENT);
     if (column.isDisposed()) error(DWT.ERROR_INVALID_ARGUMENT);
-    if (hwndHeader is 0) return -1;
+    if (hwndHeader is null) return -1;
     int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
     for (int i=0; i<count; i++) {
         if (columns [i] is column) return i;
@@ -3580,17 +3595,17 @@
     checkWidget ();
     if (item is null) error (DWT.ERROR_NULL_ARGUMENT);
     if (item.isDisposed()) error(DWT.ERROR_INVALID_ARGUMENT);
-    int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
-    return hItem is 0 ? -1 : findIndex (hItem, item.handle);
-}
-
-bool isItemSelected (NMTVCUSTOMDRAW nmcd) {
+    HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
+    return hItem is null ? -1 : findIndex (hItem, item.handle);
+}
+
+bool isItemSelected (NMTVCUSTOMDRAW* nmcd) {
     bool selected = false;
     if (OS.IsWindowEnabled (handle)) {
-        TVITEM tvItem = new TVITEM ();
+        TVITEM tvItem;
         tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_STATE;
-        tvItem.hItem = nmcd.dwItemSpec;
-        OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
+        tvItem.hItem = cast(HANDLE) nmcd.nmcd.dwItemSpec;
+        OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem);
         if ((tvItem.state & (OS.TVIS_SELECTED | OS.TVIS_DROPHILITED)) !is 0) {
             selected = true;
             /*
@@ -3610,16 +3625,16 @@
             * but this does not happen in a regular application.
             */
             if (handle is OS.GetFocus ()) {
-                if (OS.GetTextColor (nmcd.hdc) !is OS.GetSysColor (OS.COLOR_HIGHLIGHTTEXT)) {
+                if (OS.GetTextColor (nmcd.nmcd.hdc) !is OS.GetSysColor (OS.COLOR_HIGHLIGHTTEXT)) {
                     selected = false;
                 } else {
-                    if (OS.GetBkColor (nmcd.hdc) !is OS.GetSysColor (OS.COLOR_HIGHLIGHT)) {
+                    if (OS.GetBkColor (nmcd.nmcd.hdc) !is OS.GetSysColor (OS.COLOR_HIGHLIGHT)) {
                         selected = false;
                     }
                 }
             }
         } else {
-            if (nmcd.dwDrawStage is OS.CDDS_ITEMPOSTPAINT) {
+            if (nmcd.nmcd.dwDrawStage is OS.CDDS_ITEMPOSTPAINT) {
                 /*
                 * Feature in Windows.  When the mouse is pressed and the
                 * selection is first drawn for a tree, the item is drawn
@@ -3637,8 +3652,8 @@
                 * background of the tree are set to the selection colors
                 * but this does not happen in a regular application.
                 */
-                if (OS.GetTextColor (nmcd.hdc) is OS.GetSysColor (OS.COLOR_HIGHLIGHTTEXT)) {
-                    if (OS.GetBkColor (nmcd.hdc) is OS.GetSysColor (OS.COLOR_HIGHLIGHT)) {
+                if (OS.GetTextColor (nmcd.nmcd.hdc) is OS.GetSysColor (OS.COLOR_HIGHLIGHTTEXT)) {
+                    if (OS.GetBkColor (nmcd.nmcd.hdc) is OS.GetSysColor (OS.COLOR_HIGHLIGHT)) {
                         selected = true;
                     }
                 }
@@ -3650,38 +3665,38 @@
 
 void redrawSelection () {
     if ((style & DWT.SINGLE) !is 0) {
-        int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
-        if (hItem !is 0) {
-            RECT rect = new RECT ();
-            rect.left = hItem;
-            OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, rect);
-            OS.InvalidateRect (handle, rect, true);
+        HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
+        if (hItem !is null) {
+            RECT rect;
+            rect.left = cast(int) hItem;
+            OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, &rect);
+            OS.InvalidateRect (handle, &rect, true);
         }
     } else {
-        int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0);
-        if (hItem !is 0) {
-            TVITEM tvItem = null;
+        HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0);
+        if (hItem !is null) {
+            TVITEM tvItem;
             if (OS.IsWinCE) {
-                tvItem = new TVITEM ();
+                //tvItem = new TVITEM ();
                 tvItem.mask = OS.TVIF_STATE;
             }
-            RECT rect = new RECT ();
+            RECT rect;
             int index = 0, count = OS.SendMessage (handle, OS.TVM_GETVISIBLECOUNT, 0, 0);
-            while (index < count && hItem !is 0) {
+            while (index < count && hItem !is null) {
                 int state = 0;
-                if (OS.IsWinCE) {
+                static if (OS.IsWinCE) {
                     tvItem.hItem = hItem;
-                    OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
+                    OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem);
                     state = tvItem.state;
                 } else {
                     state = OS.SendMessage (handle, OS.TVM_GETITEMSTATE, hItem, OS.TVIS_SELECTED);
                 }
                 if ((state & OS.TVIS_SELECTED) !is 0) {
-                    rect.left = hItem;
-                    OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, rect);
-                    OS.InvalidateRect (handle, rect, true);
+                    rect.left = cast(int) hItem;
+                    OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, &rect);
+                    OS.InvalidateRect (handle, &rect, true);
                 }
-                hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXTVISIBLE, hItem);
+                hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXTVISIBLE, hItem);
                 index++;
             }
         }
@@ -3690,13 +3705,13 @@
 
 override void register () {
     super.register ();
-    if (hwndParent !is 0) display.addControl (hwndParent, this);
-    if (hwndHeader !is 0) display.addControl (hwndHeader, this);
+    if (hwndParent !is null) display.addControl (hwndParent, this);
+    if (hwndHeader !is null) display.addControl (hwndHeader, this);
 }
 
 void releaseItem (HANDLE hItem, TVITEM* tvItem, bool release) {
-    if (hItem is hAnchor) hAnchor = 0;
-    if (hItem is hInsert) hInsert = 0;
+    if (hItem is hAnchor) hAnchor = null;
+    if (hItem is hInsert) hInsert = null;
     tvItem.hItem = hItem;
     if (OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem) !is 0) {
         if (tvItem.lParam !is -1) {
@@ -3711,17 +3726,17 @@
 }
 
 void releaseItems (HANDLE hItem, TVITEM* tvItem) {
-    hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, hItem);
-    while (hItem !is 0) {
+    hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, hItem);
+    while (hItem !is null) {
         releaseItems (hItem, tvItem);
         releaseItem (hItem, tvItem, true);
-        hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
+        hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
     }
 }
 
 override void releaseHandle () {
     super.releaseHandle ();
-    hwndParent = hwndHeader = 0;
+    hwndParent = hwndHeader = null;
 }
 
 override void releaseChildren (bool destroy) {
@@ -3763,18 +3778,18 @@
         display.releaseImageList (imageList);
     }
     if (headerImageList !is null) {
-        if (hwndHeader !is 0) {
+        if (hwndHeader !is null) {
             OS.SendMessage (hwndHeader, OS.HDM_SETIMAGELIST, 0, 0);
         }
         display.releaseImageList (headerImageList);
     }
     imageList = headerImageList = null;
-    int hStateList = OS.SendMessage (handle, OS.TVM_GETIMAGELIST, OS.TVSIL_STATE, 0);
+    auto hStateList = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETIMAGELIST, OS.TVSIL_STATE, 0);
     OS.SendMessage (handle, OS.TVM_SETIMAGELIST, OS.TVSIL_STATE, 0);
-    if (hStateList !is 0) OS.ImageList_Destroy (hStateList);
-    if (itemToolTipHandle !is 0) OS.DestroyWindow (itemToolTipHandle);
-    if (headerToolTipHandle !is 0) OS.DestroyWindow (headerToolTipHandle);
-    itemToolTipHandle = headerToolTipHandle = 0;
+    if (hStateList !is null) OS.ImageList_Destroy (hStateList);
+    if (itemToolTipHandle !is null) OS.DestroyWindow (itemToolTipHandle);
+    if (headerToolTipHandle !is null) OS.DestroyWindow (headerToolTipHandle);
+    itemToolTipHandle = headerToolTipHandle = null;
     if (display.isXMouseActive ()) {
         Shell shell = getShell ();
         if (shell.lockToolTipControl is this) {
@@ -3793,7 +3808,7 @@
  */
 public void removeAll () {
     checkWidget ();
-    hFirstIndexOf = hLastIndexOf = 0;
+    hFirstIndexOf = hLastIndexOf = null;
     itemCount = -1;
     for (int i=0; i<items.length; i++) {
         TreeItem item = items [i];
@@ -3818,12 +3833,12 @@
         display.releaseImageList (imageList);
     }
     imageList = null;
-    if (hwndParent is 0 && !linesVisible) {
+    if (hwndParent is null && !linesVisible) {
         if (!hooks (DWT.MeasureItem) && !hooks (DWT.EraseItem) && !hooks (DWT.PaintItem)) {
             customDraw = false;
         }
     }
-    hAnchor = hInsert = hFirstIndexOf = hLastIndexOf = 0;
+    hAnchor = hInsert = hFirstIndexOf = hLastIndexOf = null;
     itemCount = -1;
     items = new TreeItem [4];
     scrollWidth = 0;
@@ -3899,7 +3914,7 @@
  */
 public void setInsertMark (TreeItem item, bool before) {
     checkWidget ();
-    int hItem = 0;
+    HANDLE hItem;
     if (item !is null) {
         if (item.isDisposed()) error(DWT.ERROR_INVALID_ARGUMENT);
         hItem = item.handle;
@@ -3924,8 +3939,8 @@
 public void setItemCount (int count) {
     checkWidget ();
     count = Math.max (0, count);
-    int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
-    setItemCount (count, OS.TVGN_ROOT, hItem);
+    HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
+    setItemCount (count, cast(HANDLE) OS.TVGN_ROOT, hItem);
 }
 
 void setItemCount (int count, HANDLE hParent, HANDLE hItem) {
@@ -3935,27 +3950,27 @@
         if (redraw) OS.DefWindowProc (handle, OS.WM_SETREDRAW, 0, 0);
     }
     int itemCount = 0;
-    while (hItem !is 0 && itemCount < count) {
-        hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
+    while (hItem !is null && itemCount < count) {
+        hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
         itemCount++;
     }
-    TVITEM tvItem = new TVITEM ();
+    TVITEM tvItem;
     tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM;
-    while (hItem !is 0) {
+    while (hItem !is null) {
         tvItem.hItem = hItem;
-        OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
-        hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
+        OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem);
+        hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
         TreeItem item = tvItem.lParam !is -1 ? items [tvItem.lParam] : null;
         if (item !is null && !item.isDisposed ()) {
             item.dispose ();
         } else {
-            releaseItem (tvItem.hItem, tvItem, false);
+            releaseItem (tvItem.hItem, &tvItem, false);
             destroyItem (null, tvItem.hItem);
         }
     }
     if ((style & DWT.VIRTUAL) !is 0) {
         for (int i=itemCount; i<count; i++) {
-            createItem (null, hParent, OS.TVI_LAST, 0);
+            createItem (null, hParent, cast(HANDLE) OS.TVI_LAST, null);
         }
     } else {
         shrink = true;
@@ -3964,7 +3979,7 @@
         System.arraycopy (items, 0, newItems, 0, items.length);
         items = newItems;
         for (int i=itemCount; i<count; i++) {
-            new TreeItem (this, DWT.NONE, hParent, OS.TVI_LAST, 0);
+            new TreeItem (this, DWT.NONE, hParent, cast(HANDLE) OS.TVI_LAST, null);
         }
     }
     if (redraw) {
@@ -4014,23 +4029,23 @@
     checkWidget ();
     if (linesVisible is show) return;
     linesVisible = show;
-    if (hwndParent is 0 && linesVisible) customDraw = true;
+    if (hwndParent is null && linesVisible) customDraw = true;
     OS.InvalidateRect (handle, null, true);
 }
 
 override HWND scrolledHandle () {
-    if (hwndHeader is 0) return handle;
+    if (hwndHeader is null) return handle;
     int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
     return count is 0 ? handle : hwndParent;
 }
 
-void select (int hItem, TVITEM tvItem) {
-    while (hItem !is 0) {
+void select (HANDLE hItem, TVITEM* tvItem) {
+    while (hItem !is null) {
         tvItem.hItem = hItem;
         OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
-        int hFirstItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, hItem);
+        auto hFirstItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, hItem);
         select (hFirstItem, tvItem);
-        hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
+        hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
     }
 }
 
@@ -4048,21 +4063,21 @@
 public void selectAll () {
     checkWidget ();
     if ((style & DWT.SINGLE) !is 0) return;
-    TVITEM tvItem = new TVITEM ();
+    TVITEM tvItem;
     tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_STATE;
     tvItem.state = OS.TVIS_SELECTED;
     tvItem.stateMask = OS.TVIS_SELECTED;
     int oldProc = OS.GetWindowLong (handle, OS.GWL_WNDPROC);
-    OS.SetWindowLong (handle, OS.GWL_WNDPROC, TreeProc);
+    OS.SetWindowLong (handle, OS.GWL_WNDPROC, cast(int) TreeProc);
     if ((style & DWT.VIRTUAL) !is 0) {
-        int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
-        select (hItem, tvItem);
+        HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
+        select (hItem, &tvItem);
     } else {
         for (int i=0; i<items.length; i++) {
             TreeItem item = items [i];
             if (item !is null) {
                 tvItem.hItem = item.handle;
-                OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
+                OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
             }
         }
     }
@@ -4071,7 +4086,7 @@
 
 override void setBackgroundImage (HBITMAP hBitmap) {
     super.setBackgroundImage (hBitmap);
-    if (hBitmap !is 0) {
+    if (hBitmap !is null) {
         /*
         * Feature in Windows.  If TVM_SETBKCOLOR is never
         * used to set the background color of a tree, the
@@ -4144,8 +4159,8 @@
     }
     super.setBounds (x, y, width, height, flags);
     if (fixSelection) {
-        int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
-        if (hItem !is 0) showItem (hItem);
+        HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
+        if (hItem !is null) showItem (hItem);
     }
 }
 
@@ -4160,7 +4175,7 @@
     * is IDC_ARROW.
     */
     Cursor cursor = findCursor ();
-    int hCursor = cursor is null ? OS.LoadCursor (0, OS.IDC_ARROW) : cursor.handle;
+    auto hCursor = cursor is null ? OS.LoadCursor (null, cast(TCHAR*) OS.IDC_ARROW) : cursor.handle;
     OS.SetCursor (hCursor);
 }
 
@@ -4192,7 +4207,7 @@
     checkWidget ();
     if (order is null) error (DWT.ERROR_NULL_ARGUMENT);
     int count = 0;
-    if (hwndHeader !is 0) {
+    if (hwndHeader !is null) {
         count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
     }
     if (count is 0) {
@@ -4201,7 +4216,7 @@
     }
     if (order.length !is count) error (DWT.ERROR_INVALID_ARGUMENT);
     int [] oldOrder = new int [count];
-    OS.SendMessage (hwndHeader, OS.HDM_GETORDERARRAY, count, oldOrder);
+    OS.SendMessage (hwndHeader, OS.HDM_GETORDERARRAY, count, oldOrder.ptr);
     bool reorder = false;
     bool [] seen = new bool [count];
     for (int i=0; i<order.length; i++) {
@@ -4214,19 +4229,19 @@
     if (reorder) {
         RECT [] oldRects = new RECT [count];
         for (int i=0; i<count; i++) {
-            oldRects [i] = new RECT ();
-            OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, i, oldRects [i]);
-        }
-        OS.SendMessage (hwndHeader, OS.HDM_SETORDERARRAY, order.length, order);
+            //oldRects [i] = new RECT ();
+            OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, i, & oldRects [i]);
+        }
+        OS.SendMessage (hwndHeader, OS.HDM_SETORDERARRAY, order.length, order.ptr);
         OS.InvalidateRect (handle, null, true);
         updateImageList ();
         TreeColumn [] newColumns = new TreeColumn [count];
         System.arraycopy (columns, 0, newColumns, 0, count);
-        RECT newRect = new RECT ();
+        RECT newRect;
         for (int i=0; i<count; i++) {
             TreeColumn column = newColumns [i];
             if (!column.isDisposed ()) {
-                OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, i, newRect);
+                OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, i, &newRect);
                 if (newRect.left !is oldRects [i].left) {
                     column.updateToolTip (i);
                     column.sendEvent (DWT.Move);
@@ -4245,7 +4260,7 @@
         if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
             flags |= OS.ILC_COLOR32;
         } else {
-            int hDC = OS.GetDC (handle);
+            auto hDC = OS.GetDC (handle);
             int bits = OS.GetDeviceCaps (hDC, OS.BITSPIXEL);
             int planes = OS.GetDeviceCaps (hDC, OS.PLANES);
             OS.ReleaseDC (handle, hDC);
@@ -4263,13 +4278,13 @@
     }
     if ((style & DWT.RIGHT_TO_LEFT) !is 0) flags |= OS.ILC_MIRROR;
     int height = OS.SendMessage (handle, OS.TVM_GETITEMHEIGHT, 0, 0), width = height;
-    int hStateList = OS.ImageList_Create (width, height, flags, count, count);
-    int hDC = OS.GetDC (handle);
-    int memDC = OS.CreateCompatibleDC (hDC);
-    int hBitmap = OS.CreateCompatibleBitmap (hDC, width * count, height);
-    int hOldBitmap = OS.SelectObject (memDC, hBitmap);
-    RECT rect = new RECT ();
-    OS.SetRect (rect, 0, 0, width * count, height);
+    auto hStateList = OS.ImageList_Create (width, height, flags, count, count);
+    auto hDC = OS.GetDC (handle);
+    auto memDC = OS.CreateCompatibleDC (hDC);
+    auto hBitmap = OS.CreateCompatibleBitmap (hDC, width * count, height);
+    auto hOldBitmap = OS.SelectObject (memDC, hBitmap);
+    RECT rect;
+    OS.SetRect (&rect, 0, 0, width * count, height);
     /*
     * NOTE: DrawFrameControl() draws a black and white
     * mask when not drawing a push button.  In order to
@@ -4287,47 +4302,47 @@
             clrBackground = 0x0200FF00;
         }
     }
-    int hBrush = OS.CreateSolidBrush (clrBackground);
-    OS.FillRect (memDC, rect, hBrush);
+    auto hBrush = OS.CreateSolidBrush (clrBackground);
+    OS.FillRect (memDC, &rect, hBrush);
     OS.DeleteObject (hBrush);
-    int oldFont = OS.SelectObject (hDC, defaultFont ());
+    auto oldFont = OS.SelectObject (hDC, defaultFont ());
     TEXTMETRIC tm;
-    OS.GetTextMetrics (hDC, tm);
+    OS.GetTextMetrics (hDC, &tm);
     OS.SelectObject (hDC, oldFont);
     int itemWidth = Math.min (tm.tmHeight, width);
     int itemHeight = Math.min (tm.tmHeight, height);
     int left = (width - itemWidth) / 2, top = (height - itemHeight) / 2 + 1;
-    OS.SetRect (rect, left + width, top, left + width + itemWidth, top + itemHeight);
+    OS.SetRect (&rect, left + width, top, left + width + itemWidth, top + itemHeight);
     if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
-        int hTheme = display.hButtonTheme ();
-        OS.DrawThemeBackground (hTheme, memDC, OS.BP_CHECKBOX, OS.CBS_UNCHECKEDNORMAL, rect, null);
+        auto hTheme = display.hButtonTheme ();
+        OS.DrawThemeBackground (hTheme, memDC, OS.BP_CHECKBOX, OS.CBS_UNCHECKEDNORMAL, &rect, null);
         rect.left += width;  rect.right += width;
-        OS.DrawThemeBackground (hTheme, memDC, OS.BP_CHECKBOX, OS.CBS_CHECKEDNORMAL, rect, null);
+        OS.DrawThemeBackground (hTheme, memDC, OS.BP_CHECKBOX, OS.CBS_CHECKEDNORMAL, &rect, null);
         rect.left += width;  rect.right += width;
-        OS.DrawThemeBackground (hTheme, memDC, OS.BP_CHECKBOX, OS.CBS_UNCHECKEDNORMAL, rect, null);
+        OS.DrawThemeBackground (hTheme, memDC, OS.BP_CHECKBOX, OS.CBS_UNCHECKEDNORMAL, &rect, null);
         rect.left += width;  rect.right += width;
-        OS.DrawThemeBackground (hTheme, memDC, OS.BP_CHECKBOX, OS.CBS_MIXEDNORMAL, rect, null);
+        OS.DrawThemeBackground (hTheme, memDC, OS.BP_CHECKBOX, OS.CBS_MIXEDNORMAL, &rect, null);
     } else {
-        OS.DrawFrameControl (memDC, rect, OS.DFC_BUTTON, OS.DFCS_BUTTONCHECK | OS.DFCS_FLAT);
+        OS.DrawFrameControl (memDC, &rect, OS.DFC_BUTTON, OS.DFCS_BUTTONCHECK | OS.DFCS_FLAT);
         rect.left += width;  rect.right += width;
-        OS.DrawFrameControl (memDC, rect, OS.DFC_BUTTON, OS.DFCS_BUTTONCHECK | OS.DFCS_CHECKED | OS.DFCS_FLAT);
+        OS.DrawFrameControl (memDC, &rect, OS.DFC_BUTTON, OS.DFCS_BUTTONCHECK | OS.DFCS_CHECKED | OS.DFCS_FLAT);
         rect.left += width;  rect.right += width;
-        OS.DrawFrameControl (memDC, rect, OS.DFC_BUTTON, OS.DFCS_BUTTONCHECK | OS.DFCS_INACTIVE | OS.DFCS_FLAT);
+        OS.DrawFrameControl (memDC, &rect, OS.DFC_BUTTON, OS.DFCS_BUTTONCHECK | OS.DFCS_INACTIVE | OS.DFCS_FLAT);
         rect.left += width;  rect.right += width;
-        OS.DrawFrameControl (memDC, rect, OS.DFC_BUTTON, OS.DFCS_BUTTONCHECK | OS.DFCS_CHECKED | OS.DFCS_INACTIVE | OS.DFCS_FLAT);
+        OS.DrawFrameControl (memDC, &rect, OS.DFC_BUTTON, OS.DFCS_BUTTONCHECK | OS.DFCS_CHECKED | OS.DFCS_INACTIVE | OS.DFCS_FLAT);
     }
     OS.SelectObject (memDC, hOldBitmap);
     OS.DeleteDC (memDC);
     OS.ReleaseDC (handle, hDC);
     if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
-        OS.ImageList_Add (hStateList, hBitmap, 0);
+        OS.ImageList_Add (hStateList, hBitmap, null);
     } else {
         OS.ImageList_AddMasked (hStateList, hBitmap, clrBackground);
     }
     OS.DeleteObject (hBitmap);
-    int hOldStateList = OS.SendMessage (handle, OS.TVM_GETIMAGELIST, OS.TVSIL_STATE, 0);
+    auto hOldStateList = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETIMAGELIST, OS.TVSIL_STATE, 0);
     OS.SendMessage (handle, OS.TVM_SETIMAGELIST, OS.TVSIL_STATE, hStateList);
-    if (hOldStateList !is 0) OS.ImageList_Destroy (hOldStateList);
+    if (hOldStateList !is null) OS.ImageList_Destroy (hOldStateList);
 }
 
 override public void setFont (Font font) {
@@ -4370,7 +4385,7 @@
  */
 public void setHeaderVisible (bool show) {
     checkWidget ();
-    if (hwndHeader is 0) {
+    if (hwndHeader is null) {
         if (!show) return;
         createParent ();
     }
@@ -4410,14 +4425,14 @@
     * when redraw is turned on and there are no items in
     * the tree.
     */
-    int hItem = 0;
+    HANDLE hItem;
     if (redraw) {
         if (drawCount is 1) {
             int count = OS.SendMessage (handle, OS.TVM_GETCOUNT, 0, 0);
             if (count is 0) {
-                TVINSERTSTRUCT tvInsert = new TVINSERTSTRUCT ();
-                tvInsert.hInsertAfter = OS.TVI_FIRST;
-                hItem = OS.SendMessage (handle, OS.TVM_INSERTITEM, 0, tvInsert);
+                TVINSERTSTRUCT tvInsert;
+                tvInsert.hInsertAfter = cast(HANDLE) OS.TVI_FIRST;
+                hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_INSERTITEM, 0, &tvInsert);
             }
             OS.DefWindowProc (handle, OS.WM_SETREDRAW, 1, 0);
         }
@@ -4426,7 +4441,7 @@
     if (!redraw) {
         if (drawCount is 1) OS.DefWindowProc (handle, OS.WM_SETREDRAW, 0, 0);
     }
-    if (hItem !is 0) {
+    if (hItem !is null) {
         ignoreShrink = true;
         OS.SendMessage (handle, OS.TVM_DELETEITEM, 0, hItem);
         ignoreShrink = false;
@@ -4434,73 +4449,69 @@
 }
 
 void setScrollWidth () {
-    if (hwndHeader is 0 || hwndParent is 0) return;
+    if (hwndHeader is null || hwndParent is null) return;
     int width = 0;
-    HDITEM hdItem = new HDITEM ();
+    HDITEM hdItem;
     int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
     for (int i=0; i<count; i++) {
         hdItem.mask = OS.HDI_WIDTH;
-        OS.SendMessage (hwndHeader, OS.HDM_GETITEM, i, hdItem);
+        OS.SendMessage (hwndHeader, OS.HDM_GETITEM, i, &hdItem);
         width += hdItem.cxy;
     }
     setScrollWidth (Math.max (scrollWidth, width));
 }
 
 void setScrollWidth (int width) {
-    if (hwndHeader is 0 || hwndParent is 0) return;
+    if (hwndHeader is null || hwndParent is null) return;
     //TEMPORARY CODE
     //scrollWidth = width;
     int left = 0;
-    RECT rect = new RECT ();
-    SCROLLINFO info = new SCROLLINFO ();
+    RECT rect;
+    SCROLLINFO info;
     info.cbSize = SCROLLINFO.sizeof;
     info.fMask = OS.SIF_RANGE | OS.SIF_PAGE;
     int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
     if (count is 0 && width is 0) {
-        OS.GetScrollInfo (hwndParent, OS.SB_HORZ, info);
+        OS.GetScrollInfo (hwndParent, OS.SB_HORZ, &info);
         info.nPage = info.nMax + 1;
-        OS.SetScrollInfo (hwndParent, OS.SB_HORZ, info, true);
-        OS.GetScrollInfo (hwndParent, OS.SB_VERT, info);
+        OS.SetScrollInfo (hwndParent, OS.SB_HORZ, &info, true);
+        OS.GetScrollInfo (hwndParent, OS.SB_VERT, &info);
         info.nPage = info.nMax + 1;
-        OS.SetScrollInfo (hwndParent, OS.SB_VERT, info, true);
+        OS.SetScrollInfo (hwndParent, OS.SB_VERT, &info, true);
     } else {
-        OS.GetClientRect (hwndParent, rect);
-        OS.GetScrollInfo (hwndParent, OS.SB_HORZ, info);
+        OS.GetClientRect (hwndParent, &rect);
+        OS.GetScrollInfo (hwndParent, OS.SB_HORZ, &info);
         info.nMax = width;
         info.nPage = rect.right - rect.left + 1;
-        OS.SetScrollInfo (hwndParent, OS.SB_HORZ, info, true);
+        OS.SetScrollInfo (hwndParent, OS.SB_HORZ, &info, true);
         info.fMask = OS.SIF_POS;
-        OS.GetScrollInfo (hwndParent, OS.SB_HORZ, info);
+        OS.GetScrollInfo (hwndParent, OS.SB_HORZ, &info);
         left = info.nPos;
     }
     if (horizontalBar !is null) {
         horizontalBar.setIncrement (INCREMENT);
         horizontalBar.setPageIncrement (info.nPage);
     }
-    OS.GetClientRect (hwndParent, rect);
-    int hHeap = OS.GetProcessHeap ();
-    HDLAYOUT playout = new HDLAYOUT ();
-    playout.prc = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, RECT.sizeof);
-    playout.pwpos = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, WINDOWPOS.sizeof);
-    OS.MoveMemory (playout.prc, rect, RECT.sizeof);
-    OS.SendMessage (hwndHeader, OS.HDM_LAYOUT, 0, playout);
-    WINDOWPOS pos = new WINDOWPOS ();
-    OS.MoveMemory (pos, playout.pwpos, WINDOWPOS.sizeof);
-    if (playout.prc !is 0) OS.HeapFree (hHeap, 0, playout.prc);
-    if (playout.pwpos !is 0) OS.HeapFree (hHeap, 0, playout.pwpos);
-    SetWindowPos (hwndHeader, OS.HWND_TOP, pos.x - left, pos.y, pos.cx + left, pos.cy, OS.SWP_NOACTIVATE);
+    OS.GetClientRect (hwndParent, &rect);
+    auto hHeap = OS.GetProcessHeap ();
+    HDLAYOUT playout;
+    playout.prc = &rect;
+    WINDOWPOS pos;
+    playout.pwpos = &pos;
+    OS.SendMessage (hwndHeader, OS.HDM_LAYOUT, 0, &playout);
+    SetWindowPos (hwndHeader, cast(HWND)OS.HWND_TOP, pos.x - left, pos.y, pos.cx + left, pos.cy, OS.SWP_NOACTIVATE);
     int bits = OS.GetWindowLong (handle, OS.GWL_EXSTYLE);
     int b = (bits & OS.WS_EX_CLIENTEDGE) !is 0 ? OS.GetSystemMetrics (OS.SM_CXEDGE) : 0;
     int w = pos.cx + (count is 0 && width is 0 ? 0 : OS.GetSystemMetrics (OS.SM_CXVSCROLL));
     int h = rect.bottom - rect.top - pos.cy;
     bool oldIgnore = ignoreResize;
     ignoreResize = true;
-    SetWindowPos (handle, 0, pos.x - left - b, pos.y + pos.cy - b, w + left + b * 2, h + b * 2, OS.SWP_NOACTIVATE | OS.SWP_NOZORDER);
+    SetWindowPos (handle, null, pos.x - left - b, pos.y + pos.cy - b, w + left + b * 2, h + b * 2, OS.SWP_NOACTIVATE | OS.SWP_NOZORDER);
     ignoreResize = oldIgnore;
 }
 
-void setSelection (int hItem, TVITEM tvItem, TreeItem [] selection) {
-    while (hItem !is 0) {
+void setSelection (HANDLE hItem, TVITEM* tvItem, TreeItem [] selection) {
+    while (hItem !is null) {
         int index = 0;
         while (index < selection.length) {
             TreeItem item = selection [index];
@@ -4508,21 +4519,21 @@
             index++;
         }
         tvItem.hItem = hItem;
-        OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
+        OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem);
         if ((tvItem.state & OS.TVIS_SELECTED) !is 0) {
             if (index is selection.length) {
                 tvItem.state = 0;
-                OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
+                OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
             }
         } else {
             if (index !is selection.length) {
                 tvItem.state = OS.TVIS_SELECTED;
-                OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
-            }
-        }
-        int hFirstItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, hItem);
+                OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
+            }
+        }
+        auto hFirstItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, hItem);
         setSelection (hFirstItem, tvItem, selection);
-        hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
+        hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXT, hItem);
     }
 }
 
@@ -4587,8 +4598,8 @@
     TreeItem item = items [0];
     if (item !is null) {
         if (item.isDisposed ()) error (DWT.ERROR_INVALID_ARGUMENT);
-        int hOldItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
-        int hNewItem = hAnchor = item.handle;
+        HANDLE hOldItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
+        HANDLE hNewItem = hAnchor = item.handle;
 
         /*
         * Bug in Windows.  When TVM_SELECTITEM is used to select and
@@ -4628,26 +4639,26 @@
         * the state mask, and to ensure that it is visible.
         */
         if (hOldItem is hNewItem) {
-            TVITEM tvItem = new TVITEM ();
+            TVITEM tvItem;
             tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_STATE;
             tvItem.state = OS.TVIS_SELECTED;
             tvItem.stateMask = OS.TVIS_SELECTED;
             tvItem.hItem = hNewItem;
-            OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
+            OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
             showItem (hNewItem);
         }
     }
     if ((style & DWT.SINGLE) !is 0) return;
 
     /* Select/deselect the rest of the items */
-    TVITEM tvItem = new TVITEM ();
+    TVITEM tvItem;
     tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_STATE;
     tvItem.stateMask = OS.TVIS_SELECTED;
     int oldProc = OS.GetWindowLong (handle, OS.GWL_WNDPROC);
-    OS.SetWindowLong (handle, OS.GWL_WNDPROC, TreeProc);
+    OS.SetWindowLong (handle, OS.GWL_WNDPROC, cast(int) TreeProc);
     if ((style & DWT.VIRTUAL) !is 0) {
-        int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
-        setSelection (hItem, tvItem, items);
+        HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
+        setSelection (hItem, &tvItem, items);
     } else {
         for (int i=0; i<this.items.length; i++) {
             item = this.items [i];
@@ -4658,16 +4669,16 @@
                     index++;
                 }
                 tvItem.hItem = item.handle;
-                OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
+                OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem);
                 if ((tvItem.state & OS.TVIS_SELECTED) !is 0) {
                     if (index is length) {
                         tvItem.state = 0;
-                        OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
+                        OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
                     }
                 } else {
                     if (index !is length) {
                         tvItem.state = OS.TVIS_SELECTED;
-                        OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
+                        OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
                     }
                 }
             }
@@ -4751,8 +4762,8 @@
     checkWidget ();
     if (item is null) DWT.error (DWT.ERROR_NULL_ARGUMENT);
     if (item.isDisposed ()) DWT.error (DWT.ERROR_INVALID_ARGUMENT);
-    int hItem = item.handle;
-    int hTopItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0);
+    HANDLE hItem = item.handle;
+    auto hTopItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0);
     if (hItem is hTopItem) return;
     bool fixScroll = checkScroll (hItem), redraw = false;
     if (fixScroll) {
@@ -4763,8 +4774,8 @@
         if (redraw) OS.DefWindowProc (handle, OS.WM_SETREDRAW, 0, 0);
     }
     OS.SendMessage (handle, OS.TVM_SELECTITEM, OS.TVGN_FIRSTVISIBLE, hItem);
-    int hParent = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_PARENT, hItem);
-    if (hParent is 0) OS.SendMessage (handle, OS.WM_HSCROLL, OS.SB_TOP, 0);
+    auto hParent = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_PARENT, hItem);
+    if (hParent is null) OS.SendMessage (handle, OS.WM_HSCROLL, OS.SB_TOP, 0);
     if (fixScroll) {
         OS.DefWindowProc (handle, OS.WM_SETREDRAW, 1, 0);
         OS.SendMessage (handle, OS.WM_SETREDRAW, 0, 0);
@@ -4777,7 +4788,7 @@
     updateScrollBar ();
 }
 
-void showItem (int hItem) {
+void showItem (HANDLE hItem) {
     /*
     * Bug in Windows.  When TVM_ENSUREVISIBLE is used to ensure
     * that an item is visible and the client area of the tree is
@@ -4804,18 +4815,18 @@
         }
     } else {
         bool scroll = true;
-        RECT itemRect = new RECT ();
-        itemRect.left = hItem;
-        if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, itemRect) !is 0) {
+        RECT itemRect;
+        itemRect.left = cast(int) hItem;
+        if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, &itemRect) !is 0) {
             forceResize ();
-            RECT rect = new RECT ();
-            OS.GetClientRect (handle, rect);
-            POINT pt = new POINT ();
+            RECT rect;
+            OS.GetClientRect (handle, &rect);
+            POINT pt;
             pt.x = itemRect.left;
             pt.y = itemRect.top;
-            if (OS.PtInRect (rect, pt)) {
+            if (OS.PtInRect (&rect, pt)) {
                 pt.y = itemRect.bottom;
-                if (OS.PtInRect (rect, pt)) scroll = false;
+                if (OS.PtInRect (&rect, pt)) scroll = false;
             }
         }
         if (scroll) {
@@ -4831,25 +4842,25 @@
             }
         }
     }
-    if (hwndParent !is 0) {
-        RECT itemRect = new RECT ();
-        itemRect.left = hItem;
-        if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, itemRect) !is 0) {
+    if (hwndParent !is null) {
+        RECT itemRect;
+        itemRect.left = cast(int) hItem;
+        if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 1, &itemRect) !is 0) {
             forceResize ();
-            RECT rect = new RECT ();
-            OS.GetClientRect (hwndParent, rect);
-            OS.MapWindowPoints (hwndParent, handle, rect, 2);
-            POINT pt = new POINT ();
+            RECT rect;
+            OS.GetClientRect (hwndParent, &rect);
+            OS.MapWindowPoints (hwndParent, handle, cast(POINT*) &rect, 2);
+            POINT pt;
             pt.x = itemRect.left;
             pt.y = itemRect.top;
-            if (!OS.PtInRect (rect, pt)) {
+            if (!OS.PtInRect (&rect, pt)) {
                 pt.y = itemRect.bottom;
-                if (!OS.PtInRect (rect, pt)) {
-                    SCROLLINFO info = new SCROLLINFO ();
+                if (!OS.PtInRect (&rect, pt)) {
+                    SCROLLINFO info;
                     info.cbSize = SCROLLINFO.sizeof;
                     info.fMask = OS.SIF_POS;
                     info.nPos = Math.max (0, pt.x - Tree.INSET / 2);
-                    OS.SetScrollInfo (hwndParent, OS.SB_HORZ, info, true);
+                    OS.SetScrollInfo (hwndParent, OS.SB_HORZ, &info, true);
                     setScrollWidth ();
                 }
             }
@@ -4885,24 +4896,24 @@
     if (index is -1) return;
     int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
     if (0 <= index && index < count) {
-        if (hwndParent !is 0) {
+        if (hwndParent !is null) {
             forceResize ();
-            RECT rect = new RECT ();
-            OS.GetClientRect (hwndParent, rect);
-            OS.MapWindowPoints (hwndParent, handle, rect, 2);
-            RECT headerRect = new RECT ();
-            OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, headerRect);
+            RECT rect;
+            OS.GetClientRect (hwndParent, &rect);
+            OS.MapWindowPoints (hwndParent, handle, cast(POINT*) &rect, 2);
+            RECT headerRect;
+            OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, index, &headerRect);
             bool scroll = headerRect.left < rect.left;
             if (!scroll) {
                 int width = Math.min (rect.right - rect.left, headerRect.right - headerRect.left);
                 scroll = headerRect.left + width > rect.right;
             }
             if (scroll) {
-                SCROLLINFO info = new SCROLLINFO ();
+                SCROLLINFO info;
                 info.cbSize = SCROLLINFO.sizeof;
                 info.fMask = OS.SIF_POS;
                 info.nPos = Math.max (0, headerRect.left - Tree.INSET / 2);
-                OS.SetScrollInfo (hwndParent, OS.SB_HORZ, info, true);
+                OS.SetScrollInfo (hwndParent, OS.SB_HORZ, &info, true);
                 setScrollWidth ();
             }
         }
@@ -4948,16 +4959,16 @@
  */
 public void showSelection () {
     checkWidget ();
-    int hItem = 0;
+    HANDLE hItem;
     if ((style & DWT.SINGLE) !is 0) {
-        hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
-        if (hItem is 0) return;
+        hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
+        if (hItem is null) return;
         int state = 0;
         if (OS.IsWinCE) {
-            TVITEM tvItem = new TVITEM ();
+            TVITEM tvItem;
             tvItem.hItem = hItem;
             tvItem.mask = OS.TVIF_STATE;
-            OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
+            OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem);
             state = tvItem.state;
         } else {
             state = OS.SendMessage (handle, OS.TVM_GETITEMSTATE, hItem, OS.TVIS_SELECTED);
@@ -4965,14 +4976,15 @@
         if ((state & OS.TVIS_SELECTED) is 0) return;
     } else {
         int oldProc = OS.GetWindowLong (handle, OS.GWL_WNDPROC);
-        OS.SetWindowLong (handle, OS.GWL_WNDPROC, TreeProc);
-        TVITEM tvItem = null;
-        if (OS.IsWinCE) {
-            tvItem = new TVITEM ();
+        OS.SetWindowLong (handle, OS.GWL_WNDPROC, cast(int) TreeProc);
+        TVITEM tvItem_;
+        TVITEM* tvItem;
+        static if (OS.IsWinCE) {
+            tvItem = &tvItem_;
             tvItem.mask = OS.TVIF_STATE;
         }
         if ((style & DWT.VIRTUAL) !is 0) {
-            int hRoot = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
+            auto hRoot = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
             hItem = getNextSelection (hRoot, tvItem);
         } else {
             //FIXME - this code expands first selected item it finds
@@ -4998,85 +5010,87 @@
         }
         OS.SetWindowLong (handle, OS.GWL_WNDPROC, oldProc);
     }
-    if (hItem !is 0) showItem (hItem);
+    if (hItem !is null) showItem (hItem);
 }
 
 /*public*/ void sort () {
     checkWidget ();
     if ((style & DWT.VIRTUAL) !is 0) return;
-    sort (OS.TVI_ROOT, false);
+    sort ( cast(HANDLE) OS.TVI_ROOT, false);
 }
 
 void sort (HANDLE hParent, bool all) {
     int itemCount = OS.SendMessage (handle, OS.TVM_GETCOUNT, 0, 0);
     if (itemCount is 0 || itemCount is 1) return;
-    hFirstIndexOf = hLastIndexOf = 0;
+    hFirstIndexOf = hLastIndexOf = null;
     itemCount = -1;
     if (sortDirection is DWT.UP || sortDirection is DWT.NONE) {
         OS.SendMessage (handle, OS.TVM_SORTCHILDREN, all ? 1 : 0, hParent);
     } else {
-        Callback compareCallback = new Callback (this, "CompareFunc", 3);
-        int lpfnCompare = compareCallback.getAddress ();
-        TVSORTCB psort = new TVSORTCB ();
+        //Callback compareCallback = new Callback (this, "CompareFunc", 3);
+        //int lpfnCompare = compareCallback.getAddress ();
+        sThis = this;
+        TVSORTCB psort;
         psort.hParent = hParent;
-        psort.lpfnCompare = lpfnCompare;
+        psort.lpfnCompare = &CompareFunc;
         psort.lParam = sortColumn is null ? 0 : indexOf (sortColumn);
-        OS.SendMessage (handle, OS.TVM_SORTCHILDRENCB, all ? 1 : 0, psort);
-        compareCallback.dispose ();
+        OS.SendMessage (handle, OS.TVM_SORTCHILDRENCB, all ? 1 : 0, &psort);
+        sThis = null;
+        //compareCallback.dispose ();
     }
 }
 
 override void subclass () {
     super.subclass ();
-    if (hwndHeader !is 0) {
+    if (hwndHeader !is null) {
         OS.SetWindowLong (hwndHeader, OS.GWL_WNDPROC, display.windowProc);
     }
 }
 
 override char[] toolTipText (NMTTDISPINFO* hdr) {
-    int hwndToolTip = OS.SendMessage (handle, OS.TVM_GETTOOLTIPS, 0, 0);
-    if (hwndToolTip is hdr.hwndFrom && toolTipText !is null) return ""; //$NON-NLS-1$
-    if (headerToolTipHandle is hdr.hwndFrom) {
+    auto hwndToolTip = cast(HWND) OS.SendMessage (handle, OS.TVM_GETTOOLTIPS, 0, 0);
+    if (hwndToolTip is hdr.hdr.hwndFrom && toolTipText_ !is null) return ""; //$NON-NLS-1$
+    if (headerToolTipHandle is hdr.hdr.hwndFrom) {
         int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
         for (int i=0; i<count; i++) {
             TreeColumn column = columns [i];
-            if (column.id is hdr.idFrom) return column.toolTipText;
+            if (column.id is hdr.hdr.idFrom) return column.toolTipText;
         }
         return super.toolTipText (hdr);
     }
-    if (itemToolTipHandle is hdr.hwndFrom && hwndHeader !is 0) {
-        if (toolTipText !is null) return "";
+    if (itemToolTipHandle is hdr.hdr.hwndFrom && hwndHeader !is null) {
+        if (toolTipText_ !is null) return "";
         if (!hooks (DWT.EraseItem) && !hooks (DWT.PaintItem)) {
             int pos = OS.GetMessagePos ();
-            POINT pt = new POINT();
+            POINT pt;
             pt.x = cast(short) (pos & 0xFFFF);
             pt.y = cast(short) (pos >> 16);
-            OS.ScreenToClient (handle, pt);
-            TVHITTESTINFO lpht = new TVHITTESTINFO ();
-            lpht.x = pt.x;
-            lpht.y = pt.y;
-            OS.SendMessage (handle, OS.TVM_HITTEST, 0, lpht);
-            if (lpht.hItem !is 0) {
-                int hDC = OS.GetDC (handle);
-                int oldFont = 0, newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
-                if (newFont !is 0) oldFont = OS.SelectObject (hDC, newFont);
-                RECT rect = new RECT ();
-                OS.GetClientRect (hwndParent, rect);
-                OS.MapWindowPoints (hwndParent, handle, rect, 2);
+            OS.ScreenToClient (handle, &pt);
+            TVHITTESTINFO lpht;
+            lpht.pt.x = pt.x;
+            lpht.pt.y = pt.y;
+            OS.SendMessage (handle, OS.TVM_HITTEST, 0, &lpht);
+            if (lpht.hItem !is null) {
+                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);
+                RECT rect;
+                OS.GetClientRect (hwndParent, &rect);
+                OS.MapWindowPoints (hwndParent, handle, cast(POINT*) &rect, 2);
                 TreeItem item = _getItem (lpht.hItem);
                 char[] text = null;
                 int index = 0, count = Math.max (1, OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0));
                 int [] order = new int [count];
-                OS.SendMessage (hwndHeader, OS.HDM_GETORDERARRAY, count, order);
+                OS.SendMessage (hwndHeader, OS.HDM_GETORDERARRAY, count, order.ptr);
                 while (index < count) {
-                    int hFont = item.cellFont !is null ? item.cellFont [order [index]] : -1;
-                    if (hFont is -1) hFont = item.font;
-                    if (hFont !is -1) hFont = OS.SelectObject (hDC, hFont);
+                    HFONT hFont = item.cellFont !is null ? item.cellFont [order [index]] : cast(HFONT)-1;
+                    if (hFont is cast(HFONT)-1) hFont = item.font;
+                    if (hFont !is cast(HFONT)-1) hFont = OS.SelectObject (hDC, hFont);
                     RECT cellRect = item.getBounds (order [index], true, false, true, false, true, hDC);
-                    if (hFont !is -1) OS.SelectObject (hDC, hFont);
+                    if (hFont !is cast(HFONT)-1) OS.SelectObject (hDC, hFont);
                     if (cellRect.left > rect.right) break;
                     cellRect.right = Math.min (cellRect.right, rect.right);
-                    if (OS.PtInRect (cellRect, pt)) {
+                    if (OS.PtInRect (&cellRect, pt)) {
                         RECT textRect = item.getBounds (order [index], true, false, false, false, false, hDC);
                         if (textRect.right > cellRect.right) {
                             if (order [index] is 0) {
@@ -5090,7 +5104,7 @@
                     }
                     index++;
                 }
-                if (newFont !is 0) OS.SelectObject (hDC, oldFont);
+                if (newFont !is null) OS.SelectObject (hDC, oldFont);
                 OS.ReleaseDC (handle, hDC);
                 if (text !is null) return text;
             }
@@ -5100,7 +5114,7 @@
 }
 
 override HWND topHandle () {
-    return hwndParent !is 0 ? hwndParent : handle;
+    return hwndParent !is null ? hwndParent : handle;
 }
 
 void updateFullSelection () {
@@ -5125,9 +5139,9 @@
 }
 
 void updateHeaderToolTips () {
-    if (headerToolTipHandle is 0) return;
-    RECT rect = new RECT ();
-    TOOLINFO lpti = new TOOLINFO ();
+    if (headerToolTipHandle is null) return;
+    RECT rect;
+    TOOLINFO lpti;
     lpti.cbSize = TOOLINFO.sizeof;
     lpti.uFlags = OS.TTF_SUBCLASS;
     lpti.hwnd = hwndHeader;
@@ -5135,20 +5149,20 @@
     int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
     for (int i=0; i<count; i++) {
         TreeColumn column = columns [i];
-        if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, i, rect) !is 0) {
+        if (OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, i, &rect) !is 0) {
             lpti.uId = column.id = display.nextToolTipId++;
-            lpti.left = rect.left;
-            lpti.top = rect.top;
-            lpti.right = rect.right;
-            lpti.bottom = rect.bottom;
-            OS.SendMessage (headerToolTipHandle, OS.TTM_ADDTOOL, 0, lpti);
+            lpti.rect.left = rect.left;
+            lpti.rect.top = rect.top;
+            lpti.rect.right = rect.right;
+            lpti.rect.bottom = rect.bottom;
+            OS.SendMessage (headerToolTipHandle, OS.TTM_ADDTOOL, 0, &lpti);
         }
     }
 }
 
 void updateImageList () {
     if (imageList is null) return;
-    if (hwndHeader is 0) return;
+    if (hwndHeader is null) return;
     int i = 0, index = OS.SendMessage (hwndHeader, OS.HDM_ORDERTOINDEX, 0, 0);
     while (i < items.length) {
         TreeItem item = items [i];
@@ -5169,8 +5183,8 @@
     * times, Windows does work making this operation slow.  The fix
     * is to test for the same image list before setting the new one.
     */
-    int hImageList = i is items.length ? 0 : imageList.getHandle ();
-    int hOldImageList = OS.SendMessage (handle, OS.TVM_GETIMAGELIST, OS.TVSIL_NORMAL, 0);
+    HBITMAP hImageList = i is items.length ? null : imageList.getHandle ();
+    HANDLE hOldImageList = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETIMAGELIST, OS.TVSIL_NORMAL, 0);
     if (hImageList !is hOldImageList) {
         OS.SendMessage (handle, OS.TVM_SETIMAGELIST, OS.TVSIL_NORMAL, hImageList);
     }
@@ -5190,21 +5204,21 @@
 }
 
 void updateScrollBar () {
-    if (hwndParent !is 0) {
+    if (hwndParent !is null) {
         int columnCount = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
         if (columnCount !is 0 || scrollWidth !is 0) {
-            SCROLLINFO info = new SCROLLINFO ();
+            SCROLLINFO info;
             info.cbSize = SCROLLINFO.sizeof;
             info.fMask = OS.SIF_ALL;
             int itemCount = OS.SendMessage (handle, OS.TVM_GETCOUNT, 0, 0);
             if (itemCount is 0) {
-                OS.GetScrollInfo (hwndParent, OS.SB_VERT, info);
+                OS.GetScrollInfo (hwndParent, OS.SB_VERT, &info);
                 info.nPage = info.nMax + 1;
-                OS.SetScrollInfo (hwndParent, OS.SB_VERT, info, true);
+                OS.SetScrollInfo (hwndParent, OS.SB_VERT, &info, true);
             } else {
-                OS.GetScrollInfo (handle, OS.SB_VERT, info);
+                OS.GetScrollInfo (handle, OS.SB_VERT, &info);
                 if (info.nPage is 0) info.nPage = info.nMax + 1;
-                OS.SetScrollInfo (hwndParent, OS.SB_VERT, info, true);
+                OS.SetScrollInfo (hwndParent, OS.SB_VERT, &info, true);
             }
         }
     }
@@ -5212,8 +5226,8 @@
 
 override void unsubclass () {
     super.unsubclass ();
-    if (hwndHeader !is 0) {
-        OS.SetWindowLong (hwndHeader, OS.GWL_WNDPROC, HeaderProc);
+    if (hwndHeader !is null) {
+        OS.SetWindowLong (hwndHeader, OS.GWL_WNDPROC, cast(int) HeaderProc);
     }
 }
 
@@ -5242,7 +5256,7 @@
 }
 
 override int windowProc (HWND hwnd, int msg, int wParam, int lParam) {
-    if (hwndHeader !is 0 && hwnd is hwndHeader) {
+    if (hwndHeader !is null && hwnd is hwndHeader) {
         switch (msg) {
             /* This code is intentionally commented */
 //          case OS.WM_CONTEXTMENU: {
@@ -5265,7 +5279,7 @@
                 * This does not happen on XP.
                 */
                 if (OS.COMCTL32_MAJOR < 6) {
-                    if (lParam !is 0 && lParam !is hwndHeader) {
+                    if (lParam !is 0 && cast(HANDLE) lParam !is hwndHeader) {
                         OS.InvalidateRect (hwndHeader, null, true);
                     }
                 }
@@ -5284,8 +5298,8 @@
                 break;
             }
             case OS.WM_NOTIFY: {
-                NMHDR hdr = new NMHDR ();
-                OS.MoveMemory (hdr, lParam, NMHDR.sizeof);
+                NMHDR* hdr = cast(NMHDR*)lParam;
+                //OS.MoveMemory (hdr, lParam, NMHDR.sizeof);
                 switch (hdr.code) {
                     case OS.TTN_SHOW:
                     case OS.TTN_POP:
@@ -5296,22 +5310,22 @@
                 break;
             }
             case OS.WM_SETCURSOR: {
-                if (wParam is hwnd) {
+                if (cast(HWND)wParam is hwnd) {
                     int hitTest = cast(short) (lParam & 0xFFFF);
                     if (hitTest is OS.HTCLIENT) {
-                        HDHITTESTINFO pinfo = new HDHITTESTINFO ();
+                        HDHITTESTINFO pinfo;
                         int pos = OS.GetMessagePos ();
-                        POINT pt = new POINT ();
+                        POINT pt;
                         pt.x = cast(short) (pos & 0xFFFF);
                         pt.y = cast(short) (pos >> 16);
-                        OS.ScreenToClient (hwnd, pt);
-                        pinfo.x = pt.x;
-                        pinfo.y = pt.y;
+                        OS.ScreenToClient (hwnd, &pt);
+                        pinfo.pt.x = pt.x;
+                        pinfo.pt.y = pt.y;
                         int columnCount = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
-                        int index = OS.SendMessage (hwndHeader, OS.HDM_HITTEST, 0, pinfo);
+                        int index = OS.SendMessage (hwndHeader, OS.HDM_HITTEST, 0, &pinfo);
                         if (0 <= index && index < columnCount && !columns [index].resizable) {
                             if ((pinfo.flags & (OS.HHT_ONDIVIDER | OS.HHT_ONDIVOPEN)) !is 0) {
-                                OS.SetCursor (OS.LoadCursor (0, OS.IDC_ARROW));
+                                OS.SetCursor (OS.LoadCursor (null, cast(TCHAR*) OS.IDC_ARROW));
                                 return 1;
                             }
                         }
@@ -5322,7 +5336,7 @@
         }
         return callWindowProc (hwnd, msg, wParam, lParam);
     }
-    if (hwndParent !is 0 && hwnd is hwndParent) {
+    if (hwndParent !is null && hwnd is hwndParent) {
         switch (msg) {
             case OS.WM_MOVE: {
                 sendEvent (DWT.Move);
@@ -5335,7 +5349,7 @@
                 int code = callWindowProc (hwnd, OS.WM_SIZE, wParam, lParam);
                 sendEvent (DWT.Resize);
                 if (isDisposed ()) return 0;
-                if (layout !is null) {
+                if (layout_ !is null) {
                     markLayout (false, false);
                     updateLayout (false, false);
                 }
@@ -5345,12 +5359,12 @@
             }
             case OS.WM_NCPAINT: {
                 LRESULT result = wmNCPaint (hwnd, wParam, lParam);
-                if (result !is null) return result.value;
+                if (result !is LRESULT.NULL) return result;
                 break;
             }
             case OS.WM_PRINT: {
                 LRESULT result = wmPrint (hwnd, wParam, lParam);
-                if (result !is null) return result.value;
+                if (result !is LRESULT.NULL) return result;
                 break;
             }
             case OS.WM_COMMAND:
@@ -5366,17 +5380,17 @@
                 * contains the handle to the scroll bar.  The fix is to check for
                 * both.
                 */
-                if (horizontalBar !is null && (lParam is 0 || lParam is hwndParent)) {
+                if (horizontalBar !is null && (lParam is 0 || lParam is cast(int)hwndParent)) {
                     wmScroll (horizontalBar, true, hwndParent, OS.WM_HSCROLL, wParam, lParam);
                 }
                 setScrollWidth ();
                 break;
             }
             case OS.WM_VSCROLL: {
-                SCROLLINFO info = new SCROLLINFO ();
+                SCROLLINFO info;
                 info.cbSize = SCROLLINFO.sizeof;
                 info.fMask = OS.SIF_ALL;
-                OS.GetScrollInfo (hwndParent, OS.SB_VERT, info);
+                OS.GetScrollInfo (hwndParent, OS.SB_VERT, &info);
                 /*
                 * Update the nPos field to match the nTrackPos field
                 * so that the tree scrolls when the scroll bar of the
@@ -5390,11 +5404,11 @@
                         info.nPos = info.nTrackPos;
                     }
                 }
-                OS.SetScrollInfo (handle, OS.SB_VERT, info, true);
+                OS.SetScrollInfo (handle, OS.SB_VERT, &info, true);
                 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 code;
+                OS.GetScrollInfo (handle, OS.SB_VERT, &info);
+                OS.SetScrollInfo (hwndParent, OS.SB_VERT, &info, true);
+                return cast(LRESULT)code;
             }
         }
         return callWindowProc (hwnd, msg, wParam, lParam);
@@ -5404,7 +5418,7 @@
 
 override LRESULT WM_CHAR (int wParam, int lParam) {
     LRESULT result = super.WM_CHAR (wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     /*
     * Feature in Windows.  The tree control beeps
     * in WM_CHAR when the search for the item that
@@ -5416,16 +5430,16 @@
     */
     switch (wParam) {
         case ' ': {
-            int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
-            if (hItem !is 0) {
+            HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
+            if (hItem !is null) {
                 hAnchor = hItem;
                 OS.SendMessage (handle, OS.TVM_ENSUREVISIBLE, 0, hItem);
-                TVITEM tvItem = new TVITEM ();
+                TVITEM tvItem;
                 tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_STATE | OS.TVIF_PARAM;
                 tvItem.hItem = hItem;
                 if ((style & DWT.CHECK) !is 0) {
                     tvItem.stateMask = OS.TVIS_STATEIMAGEMASK;
-                    OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
+                    OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem);
                     int state = tvItem.state >> 12;
                     if ((state & 0x1) !is 0) {
                         state++;
@@ -5433,9 +5447,9 @@
                         --state;
                     }
                     tvItem.state = state << 12;
-                    OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
+                    OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
                     if (!OS.IsWinCE) {
-                        int id = hItem;
+                        int id = cast(int) hItem;
                         if (OS.COMCTL32_MAJOR >= 6) {
                             id = OS.SendMessage (handle, OS.TVM_MAPHTREEITEMTOACCID, hItem, 0);
                         }
@@ -5443,7 +5457,7 @@
                     }
                 }
                 tvItem.stateMask = OS.TVIS_SELECTED;
-                OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
+                OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem);
                 if ((style & DWT.MULTI) !is 0 && OS.GetKeyState (OS.VK_CONTROL) < 0) {
                     if ((tvItem.state & OS.TVIS_SELECTED) !is 0) {
                         tvItem.state &= ~OS.TVIS_SELECTED;
@@ -5453,7 +5467,7 @@
                 } else {
                     tvItem.state |= OS.TVIS_SELECTED;
                 }
-                OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
+                OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
                 TreeItem item = _getItem (hItem, tvItem.lParam);
                 Event event = new Event ();
                 event.item = item;
@@ -5477,8 +5491,8 @@
             * using NM_RETURN.
             */
             Event event = new Event ();
-            int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
-            if (hItem !is 0) event.item = _getItem (hItem);
+            HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
+            if (hItem !is null) event.item = _getItem (hItem);
             postEvent (DWT.DefaultSelection, event);
             return LRESULT.ZERO;
         }
@@ -5502,7 +5516,7 @@
     * accessibility is temporarily implemented in the accessibility
     * package.
     */
-    if ((style & DWT.CHECK) !is 0 || hwndParent !is 0) {
+    if ((style & DWT.CHECK) !is 0 || hwndParent !is null) {
         if (accessible is null) accessible = new_Accessible (this);
     }
     return super.WM_GETOBJECT (wParam, lParam);
@@ -5510,7 +5524,7 @@
 
 override LRESULT WM_KEYDOWN (int wParam, int lParam) {
     LRESULT result = super.WM_KEYDOWN (wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     switch (wParam) {
         case OS.VK_SPACE:
             /*
@@ -5522,7 +5536,7 @@
             return LRESULT.ZERO;
         case OS.VK_ADD:
             if (OS.GetKeyState (OS.VK_CONTROL) < 0) {
-                if (hwndHeader !is 0) {
+                if (hwndHeader !is null) {
                     int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
                     TreeColumn [] newColumns = new TreeColumn [count];
                     System.arraycopy (columns, 0, newColumns, 0, count);
@@ -5544,102 +5558,102 @@
             OS.SendMessage (handle, OS.WM_CHANGEUISTATE, OS.UIS_INITIALIZE, 0);
             if ((style & DWT.SINGLE) !is 0) break;
             if (OS.GetKeyState (OS.VK_SHIFT) < 0) {
-                int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
-                if (hItem !is 0) {
-                    if (hAnchor is 0) hAnchor = hItem;
+                HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
+                if (hItem !is null) {
+                    if (hAnchor is null) hAnchor = hItem;
                     ignoreSelect = ignoreDeselect = true;
                     int code = callWindowProc (handle, OS.WM_KEYDOWN, wParam, lParam);
                     ignoreSelect = ignoreDeselect = false;
-                    int hNewItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
-                    TVITEM tvItem = new TVITEM ();
+                    auto hNewItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
+                    TVITEM tvItem;
                     tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_STATE;
                     tvItem.stateMask = OS.TVIS_SELECTED;
-                    int hDeselectItem = hItem;
-                    RECT rect1 = new RECT ();
-                    rect1.left = hAnchor;
-                    OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, rect1);
-                    RECT rect2 = new RECT ();
-                    rect2.left = hDeselectItem;
-                    OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, rect2);
+                    auto hDeselectItem = hItem;
+                    RECT rect1;
+                    rect1.left = cast(int)hAnchor;
+                    OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, &rect1);
+                    RECT rect2;
+                    rect2.left = cast(int)hDeselectItem;
+                    OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, &rect2);
                     int flags = rect1.top < rect2.top ? OS.TVGN_PREVIOUSVISIBLE : OS.TVGN_NEXTVISIBLE;
                     while (hDeselectItem !is hAnchor) {
                         tvItem.hItem = hDeselectItem;
-                        OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
-                        hDeselectItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, flags, hDeselectItem);
+                        OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
+                        hDeselectItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, flags, hDeselectItem);
                     }
-                    int hSelectItem = hAnchor;
-                    rect1.left = hNewItem;
-                    OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, rect1);
-                    rect2.left = hSelectItem;
-                    OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, rect2);
+                    auto hSelectItem = hAnchor;
+                    rect1.left = cast(int)hNewItem;
+                    OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, &rect1);
+                    rect2.left = cast(int)hSelectItem;
+                    OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, &rect2);
                     tvItem.state = OS.TVIS_SELECTED;
                     flags = rect1.top < rect2.top ? OS.TVGN_PREVIOUSVISIBLE : OS.TVGN_NEXTVISIBLE;
                     while (hSelectItem !is hNewItem) {
                         tvItem.hItem = hSelectItem;
-                        OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
-                        hSelectItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, flags, hSelectItem);
+                        OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
+                        hSelectItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, flags, hSelectItem);
                     }
                     tvItem.hItem = hNewItem;
-                    OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
+                    OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
                     tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM;
                     tvItem.hItem = hNewItem;
-                    OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
+                    OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem);
                     Event event = new Event ();
                     event.item = _getItem (hNewItem, tvItem.lParam);
                     postEvent (DWT.Selection, event);
-                    return new LRESULT (code);
+                    return cast(LRESULT) (code);
                 }
             }
             if (OS.GetKeyState (OS.VK_CONTROL) < 0) {
-                int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
-                if (hItem !is 0) {
-                    TVITEM tvItem = new TVITEM ();
+                HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
+                if (hItem !is null) {
+                    TVITEM tvItem;
                     tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_STATE;
                     tvItem.stateMask = OS.TVIS_SELECTED;
                     tvItem.hItem = hItem;
-                    OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
+                    OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem);
                     bool oldSelected = (tvItem.state & OS.TVIS_SELECTED) !is 0;
-                    int hNewItem = 0;
+                    HANDLE hNewItem;
                     switch (wParam) {
                         case OS.VK_UP:
-                            hNewItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_PREVIOUSVISIBLE, hItem);
+                            hNewItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_PREVIOUSVISIBLE, hItem);
                             break;
                         case OS.VK_DOWN:
-                            hNewItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXTVISIBLE, hItem);
+                            hNewItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXTVISIBLE, hItem);
                             break;
                         case OS.VK_HOME:
-                            hNewItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
+                            hNewItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
                             break;
                         case OS.VK_PRIOR:
-                            hNewItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0);
+                            hNewItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0);
                             if (hNewItem is hItem) {
                                 OS.SendMessage (handle, OS.WM_VSCROLL, OS.SB_PAGEUP, 0);
-                                hNewItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0);
+                                hNewItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0);
                             }
                             break;
                         case OS.VK_NEXT:
-                            RECT rect = new RECT (), clientRect = new RECT ();
-                            OS.GetClientRect (handle, clientRect);
-                            hNewItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0);
+                            RECT rect, clientRect;
+                            OS.GetClientRect (handle, &clientRect);
+                            hNewItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0);
                             do {
-                                int hVisible = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXTVISIBLE, hNewItem);
-                                if (hVisible is 0) break;
-                                rect.left = hVisible;
-                                OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, rect);
+                                auto hVisible = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXTVISIBLE, hNewItem);
+                                if (hVisible is null) break;
+                                rect.left = cast(int)hVisible;
+                                OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, &rect);
                                 if (rect.bottom > clientRect.bottom) break;
                                 if ((hNewItem = hVisible) is hItem) {
                                     OS.SendMessage (handle, OS.WM_VSCROLL, OS.SB_PAGEDOWN, 0);
                                 }
-                            } while (hNewItem !is 0);
+                            } while (hNewItem !is null);
                             break;
                         case OS.VK_END:
-                            hNewItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_LASTVISIBLE, 0);
+                            hNewItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_LASTVISIBLE, 0);
                             break;
                     }
-                    if (hNewItem !is 0) {
+                    if (hNewItem !is null) {
                         OS.SendMessage (handle, OS.TVM_ENSUREVISIBLE, 0, hNewItem);
                         tvItem.hItem = hNewItem;
-                        OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
+                        OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem);
                         bool newSelected = (tvItem.state & OS.TVIS_SELECTED) !is 0;
                         bool redraw = !newSelected && drawCount is 0 && OS.IsWindowVisible (handle);
                         if (redraw) {
@@ -5650,28 +5664,28 @@
                         ignoreSelect = true;
                         OS.SendMessage (handle, OS.TVM_SELECTITEM, OS.TVGN_CARET, hNewItem);
                         ignoreSelect = false;
-                        hSelect = 0;
+                        hSelect = null;
                         if (oldSelected) {
                             tvItem.state = OS.TVIS_SELECTED;
                             tvItem.hItem = hItem;
-                            OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
+                            OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
                         }
                         if (!newSelected) {
                             tvItem.state = 0;
                             tvItem.hItem = hNewItem;
-                            OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
+                            OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
                         }
                         if (redraw) {
-                            RECT rect1 = new RECT (), rect2 = new RECT ();
-                            rect1.left = hItem;  rect2.left = hNewItem;
+                            RECT rect1, rect2;
+                            rect1.left = cast(int) hItem;  rect2.left = cast(int) hNewItem;
                             int fItemRect = (style & DWT.FULL_SELECTION) !is 0 ? 0 : 1;
                             if (hooks (DWT.EraseItem) || hooks (DWT.PaintItem)) fItemRect = 0;
                             if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) fItemRect = 0;
-                            OS.SendMessage (handle, OS.TVM_GETITEMRECT, fItemRect, rect1);
-                            OS.SendMessage (handle, OS.TVM_GETITEMRECT, fItemRect, rect2);
+                            OS.SendMessage (handle, OS.TVM_GETITEMRECT, fItemRect, &rect1);
+                            OS.SendMessage (handle, OS.TVM_GETITEMRECT, fItemRect, &rect2);
                             OS.DefWindowProc (handle, OS.WM_SETREDRAW, 1, 0);
-                            OS.InvalidateRect (handle, rect1, true);
-                            OS.InvalidateRect (handle, rect2, true);
+                            OS.InvalidateRect (handle, &rect1, true);
+                            OS.InvalidateRect (handle, &rect2, true);
                             OS.UpdateWindow (handle);
                         }
                         return LRESULT.ZERO;
@@ -5679,8 +5693,8 @@
                 }
             }
             int code = callWindowProc (handle, OS.WM_KEYDOWN, wParam, lParam);
-            hAnchor = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
-            return new LRESULT (code);
+            hAnchor = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
+            return cast(LRESULT) (code);
         }
     }
     return result;
@@ -5717,11 +5731,11 @@
 }
 
 override LRESULT WM_LBUTTONDBLCLK (int wParam, int lParam) {
-    TVHITTESTINFO lpht = new TVHITTESTINFO ();
-    lpht.x = cast(short) (lParam & 0xFFFF);
-    lpht.y = cast(short) (lParam >> 16);
-    OS.SendMessage (handle, OS.TVM_HITTEST, 0, lpht);
-    if (lpht.hItem !is 0) {
+    TVHITTESTINFO lpht;
+    lpht.pt.x = cast(short) (lParam & 0xFFFF);
+    lpht.pt.y = cast(short) (lParam >> 16);
+    OS.SendMessage (handle, OS.TVM_HITTEST, 0, &lpht);
+    if (lpht.hItem !is null) {
         if ((style & DWT.CHECK) !is 0) {
             if ((lpht.flags & OS.TVHT_ONITEMSTATEICON) !is 0) {
                 Display display = this.display;
@@ -5737,11 +5751,11 @@
                     if (OS.GetCapture () !is handle) OS.SetCapture (handle);
                 }
                 OS.SetFocus (handle);
-                TVITEM tvItem = new TVITEM ();
+                TVITEM tvItem;
                 tvItem.hItem = lpht.hItem;
                 tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM | OS.TVIF_STATE;
                 tvItem.stateMask = OS.TVIS_STATEIMAGEMASK;
-                OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
+                OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem);
                 int state = tvItem.state >> 12;
                 if ((state & 0x1) !is 0) {
                     state++;
@@ -5749,9 +5763,9 @@
                     --state;
                 }
                 tvItem.state = state << 12;
-                OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
+                OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
                 if (!OS.IsWinCE) {
-                    int id = tvItem.hItem;
+                    int id = cast(int) tvItem.hItem;
                     if (OS.COMCTL32_MAJOR >= 6) {
                         id = OS.SendMessage (handle, OS.TVM_MAPHTREEITEMTOACCID, tvItem.hItem, 0);
                     }
@@ -5767,7 +5781,7 @@
     }
     LRESULT result = super.WM_LBUTTONDBLCLK (wParam, lParam);
     if (result is LRESULT.ZERO) return result;
-    if (lpht.hItem !is 0) {
+    if (lpht.hItem !is null) {
         if ((style & DWT.FULL_SELECTION) !is 0 || (lpht.flags & OS.TVHT_ONITEM) !is 0) {
             Event event = new Event ();
             event.item = _getItem (lpht.hItem);
@@ -5785,11 +5799,11 @@
     * are cleared.  This code also runs in the case when the white space
     * below the last item is selected.
     */
-    TVHITTESTINFO lpht = new TVHITTESTINFO ();
-    lpht.x = cast(short) (lParam & 0xFFFF);
-    lpht.y = cast(short) (lParam >> 16);
-    OS.SendMessage (handle, OS.TVM_HITTEST, 0, lpht);
-    if (lpht.hItem is 0 || (lpht.flags & OS.TVHT_ONITEMBUTTON) !is 0) {
+    TVHITTESTINFO lpht;
+    lpht.pt.x = cast(short) (lParam & 0xFFFF);
+    lpht.pt.y = cast(short) (lParam >> 16);
+    OS.SendMessage (handle, OS.TVM_HITTEST, 0, &lpht);
+    if (lpht.hItem is null || (lpht.flags & OS.TVHT_ONITEMBUTTON) !is 0) {
         Display display = this.display;
         display.captureChanged = false;
         if (!sendMouseEvent (DWT.MouseDown, 1, handle, OS.WM_LBUTTONDOWN, wParam, lParam)) {
@@ -5799,28 +5813,28 @@
             return LRESULT.ZERO;
         }
         bool fixSelection = false, deselected = false;
-        if (lpht.hItem !is 0 && (style & DWT.MULTI) !is 0) {
+        if (lpht.hItem !is null && (style & DWT.MULTI) !is 0) {
             int hSelection = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
             if (hSelection !is 0) {
-                TVITEM tvItem = new TVITEM ();
+                TVITEM tvItem;
                 tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_STATE;
                 tvItem.hItem = lpht.hItem;
-                OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
+                OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem);
                 if ((tvItem.state & OS.TVIS_EXPANDED) !is 0) {
                     fixSelection = true;
                     tvItem.stateMask = OS.TVIS_SELECTED;
-                    int hNext = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXTVISIBLE, lpht.hItem);
-                    while (hNext !is 0) {
+                    auto hNext = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXTVISIBLE, lpht.hItem);
+                    while (hNext !is null) {
                         tvItem.hItem = hNext;
-                        OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
+                        OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem);
                         if ((tvItem.state & OS.TVIS_SELECTED) !is 0) deselected = true;
                         tvItem.state = 0;
-                        OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
-                        int hItem = hNext = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXTVISIBLE, hNext);
-                        while (hItem !is 0 && hItem !is lpht.hItem) {
-                            hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_PARENT, hItem);
+                        OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
+                        HANDLE hItem = hNext = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_NEXTVISIBLE, hNext);
+                        while (hItem !is null && hItem !is lpht.hItem) {
+                            hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_PARENT, hItem);
                         }
-                        if (hItem is 0) break;
+                        if (hItem is null) break;
                     }
                 }
             }
@@ -5839,7 +5853,7 @@
             event.item = _getItem (lpht.hItem);
             postEvent (DWT.Selection, event);
         }
-        return new LRESULT (code);
+        return cast(LRESULT) (code);
     }
 
     /* Look for check/uncheck */
@@ -5857,11 +5871,11 @@
                 if (OS.GetCapture () !is handle) OS.SetCapture (handle);
             }
             OS.SetFocus (handle);
-            TVITEM tvItem = new TVITEM ();
+            TVITEM tvItem;
             tvItem.hItem = lpht.hItem;
             tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM | OS.TVIF_STATE;
             tvItem.stateMask = OS.TVIS_STATEIMAGEMASK;
-            OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
+            OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem);
             int state = tvItem.state >> 12;
             if ((state & 0x1) !is 0) {
                 state++;
@@ -5869,9 +5883,9 @@
                 --state;
             }
             tvItem.state = state << 12;
-            OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
+            OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
             if (!OS.IsWinCE) {
-                int id = tvItem.hItem;
+                int id = cast(int) tvItem.hItem;
                 if (OS.COMCTL32_MAJOR >= 6) {
                     id = OS.SendMessage (handle, OS.TVM_MAPHTREEITEMTOACCID, tvItem.hItem, 0);
                 }
@@ -5900,28 +5914,28 @@
             if (!display.captureChanged && !isDisposed ()) {
                 if (OS.GetCapture () !is handle) OS.SetCapture (handle);
             }
-            return new LRESULT (code);
+            return cast(LRESULT) (code);
         }
     }
 
     /* Get the selected state of the item under the mouse */
-    TVITEM tvItem = new TVITEM ();
+    TVITEM tvItem;
     tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_STATE;
     tvItem.stateMask = OS.TVIS_SELECTED;
     bool hittestSelected = false, focused = false;
     if ((style & DWT.MULTI) !is 0) {
         tvItem.hItem = lpht.hItem;
-        OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
+        OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem);
         hittestSelected = (tvItem.state & OS.TVIS_SELECTED) !is 0;
         focused = OS.GetFocus () is handle;
     }
 
     /* Get the selected state of the last selected item */
     bool redraw = false;
-    int hOldItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
+    auto hOldItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
     if ((style & DWT.MULTI) !is 0) {
         tvItem.hItem = hOldItem;
-        OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
+        OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem);
 
         /* Check for CONTROL or drag selection */
         if (hittestSelected || (wParam & OS.MK_CONTROL) !is 0) {
@@ -5974,7 +5988,7 @@
     dragStarted = gestureCompleted = false;
     ignoreDeselect = ignoreSelect = true;
     int code = callWindowProc (handle, OS.WM_LBUTTONDOWN, wParam, lParam);
-    int hNewItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
+    auto hNewItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
     /*
     * Feature in Windows.  When the tree has the style
     * TVS_FULLROWSELECT, the background color for the
@@ -5987,15 +6001,15 @@
         if ((bits & OS.TVS_FULLROWSELECT) is 0) {
             if (hNewItem is hOldItem && lpht.hItem !is hOldItem) {
                 OS.SendMessage (handle, OS.TVM_SELECTITEM, OS.TVGN_CARET, lpht.hItem);
-                hNewItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
-            }
-            if (!dragStarted && lpht.hItem !is 0 && (state & DRAG_DETECT) !is 0 && hooks (DWT.DragDetect)) {
-                dragStarted = dragDetect (handle, lpht.x, lpht.y, false, null, null);
+                hNewItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);
+            }
+            if (!dragStarted && lpht.hItem !is null && (state & DRAG_DETECT) !is 0 && hooks (DWT.DragDetect)) {
+                dragStarted = dragDetect (handle, lpht.pt.x, lpht.pt.y, false, null, null);
             }
         }
     }
     ignoreDeselect = ignoreSelect = false;
-    hSelect = 0;
+    hSelect = null;
     if (dragStarted) {
         if (!display.captureChanged && !isDisposed ()) {
             if (OS.GetCapture () !is handle) OS.SetCapture (handle);
@@ -6016,7 +6030,7 @@
             tvItem.state = OS.TVIS_SELECTED;
             tvItem.stateMask = OS.TVIS_SELECTED;
             tvItem.hItem = hNewItem;
-            OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
+            OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
         }
     }
 
@@ -6029,32 +6043,32 @@
                 if ((wParam & OS.MK_CONTROL) !is 0) {
                     tvItem.state ^= OS.TVIS_SELECTED;
                     if (dragStarted) tvItem.state = OS.TVIS_SELECTED;
-                    OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
+                    OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
                 }
             } else {
                 if ((tvItem.state & OS.TVIS_SELECTED) !is 0) {
                     tvItem.state = OS.TVIS_SELECTED;
-                    OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
+                    OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
                 }
                 if ((wParam & OS.MK_CONTROL) !is 0 && !dragStarted) {
                     if (hittestSelected) {
                         tvItem.state = 0;
                         tvItem.hItem = lpht.hItem;
-                        OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
+                        OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
                     }
                 }
             }
             if (redraw) {
-                RECT rect1 = new RECT (), rect2 = new RECT ();
-                rect1.left = hOldItem;  rect2.left = hNewItem;
+                RECT rect1, rect2;
+                rect1.left = cast(int) hOldItem;  rect2.left = cast(int) hNewItem;
                 int fItemRect = (style & DWT.FULL_SELECTION) !is 0 ? 0 : 1;
                 if (hooks (DWT.EraseItem) || hooks (DWT.PaintItem)) fItemRect = 0;
                 if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) fItemRect = 0;
-                OS.SendMessage (handle, OS.TVM_GETITEMRECT, fItemRect, rect1);
-                OS.SendMessage (handle, OS.TVM_GETITEMRECT, fItemRect, rect2);
+                OS.SendMessage (handle, OS.TVM_GETITEMRECT, fItemRect, &rect1);
+                OS.SendMessage (handle, OS.TVM_GETITEMRECT, fItemRect, &rect2);
                 OS.DefWindowProc (handle, OS.WM_SETREDRAW, 1, 0);
-                OS.InvalidateRect (handle, rect1, true);
-                OS.InvalidateRect (handle, rect2, true);
+                OS.InvalidateRect (handle, &rect1, true);
+                OS.InvalidateRect (handle, &rect2, true);
                 OS.UpdateWindow (handle);
             }
         }
@@ -6064,39 +6078,39 @@
             if (!hittestSelected || !dragStarted) {
                 tvItem.state = 0;
                 int oldProc = OS.GetWindowLong (handle, OS.GWL_WNDPROC);
-                OS.SetWindowLong (handle, OS.GWL_WNDPROC, TreeProc);
+                OS.SetWindowLong (handle, OS.GWL_WNDPROC, cast(int) TreeProc);
                 if ((style & DWT.VIRTUAL) !is 0) {
-                    int hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
-                    deselect (hItem, tvItem, hNewItem);
+                    HANDLE hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_ROOT, 0);
+                    deselect (hItem, &tvItem, hNewItem);
                 } else {
                     for (int i=0; i<items.length; i++) {
                         TreeItem item = items [i];
                         if (item !is null && item.handle !is hNewItem) {
                             tvItem.hItem = item.handle;
-                            OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
+                            OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
                         }
                     }
                 }
                 tvItem.hItem = hNewItem;
                 tvItem.state = OS.TVIS_SELECTED;
-                OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
+                OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
                 OS.SetWindowLong (handle, OS.GWL_WNDPROC, oldProc);
                 if ((wParam & OS.MK_SHIFT) !is 0) {
-                    RECT rect1 = new RECT ();
-                    if (hAnchor is 0) hAnchor = hNewItem;
-                    rect1.left = hAnchor;
-                    if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, rect1) !is 0) {
-                        RECT rect2 = new RECT ();
-                        rect2.left = hNewItem;
-                        OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, rect2);
+                    RECT rect1;
+                    if (hAnchor is null) hAnchor = hNewItem;
+                    rect1.left = cast(int) hAnchor;
+                    if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, &rect1) !is 0) {
+                        RECT rect2;
+                        rect2.left = cast(int) hNewItem;
+                        OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, &rect2);
                         int flags = rect1.top < rect2.top ? OS.TVGN_NEXTVISIBLE : OS.TVGN_PREVIOUSVISIBLE;
                         tvItem.state = OS.TVIS_SELECTED;
-                        int hItem = tvItem.hItem = hAnchor;
-                        OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
+                        auto hItem = tvItem.hItem = hAnchor;
+                        OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
                         while (hItem !is hNewItem) {
                             tvItem.hItem = hItem;
-                            OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
-                            hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, flags, hItem);
+                            OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
+                            hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, flags, hItem);
                         }
                     }
                 }
@@ -6109,7 +6123,7 @@
     if (!gestureCompleted) {
         tvItem.hItem = hNewItem;
         tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM;
-        OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
+        OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem);
         Event event = new Event ();
         event.item = _getItem (tvItem.hItem, tvItem.lParam);
         postEvent (DWT.Selection, event);
@@ -6133,14 +6147,14 @@
         }
     }
     dragStarted = false;
-    return new LRESULT (code);
+    return cast(LRESULT) (code);
 }
 
 override LRESULT WM_MOUSEMOVE (int wParam, int lParam) {
     Display display = this.display;
     LRESULT result = super.WM_MOUSEMOVE (wParam, lParam);
-    if (result !is null) return result;
-    if (itemToolTipHandle !is 0 && hwndHeader !is 0) {
+    if (result !is LRESULT.NULL) return result;
+    if (itemToolTipHandle !is null && hwndHeader !is null) {
         /*
         * Bug in Windows.  On some machines that do not have XBUTTONs,
         * the MK_XBUTTON1 and OS.MK_XBUTTON2 bits are sometimes set,
@@ -6150,51 +6164,51 @@
         int mask = OS.MK_LBUTTON | OS.MK_MBUTTON | OS.MK_RBUTTON;
         if (display.xMouse) mask |= OS.MK_XBUTTON1 | OS.MK_XBUTTON2;
         if (((wParam & 0xFFFF) & mask) is 0) {
-            TVHITTESTINFO lpht = new TVHITTESTINFO ();
-            lpht.x = cast(short) (lParam & 0xFFFF);
-            lpht.y = cast(short) (lParam >> 16);
-            OS.SendMessage (handle, OS.TVM_HITTEST, 0, lpht);
-            if (lpht.hItem !is 0) {
-                int hDC = OS.GetDC (handle);
-                int oldFont = 0, newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
-                if (newFont !is 0) oldFont = OS.SelectObject (hDC, newFont);
-                POINT pt = new POINT();
-                pt.x = lpht.x;
-                pt.y = lpht.y;
-                RECT rect = new RECT ();
-                OS.GetClientRect (hwndParent, rect);
-                OS.MapWindowPoints (hwndParent, handle, rect, 2);
+            TVHITTESTINFO lpht;
+            lpht.pt.x = cast(short) (lParam & 0xFFFF);
+            lpht.pt.y = cast(short) (lParam >> 16);
+            OS.SendMessage (handle, OS.TVM_HITTEST, 0, &lpht);
+            if (lpht.hItem !is null) {
+                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);
+                POINT pt;
+                pt.x = lpht.pt.x;
+                pt.y = lpht.pt.y;
+                RECT rect;
+                OS.GetClientRect (hwndParent, &rect);
+                OS.MapWindowPoints (hwndParent, handle, cast(POINT*) &rect, 2);
                 TreeItem item = _getItem (lpht.hItem);
                 int index = 0, count = Math.max (1, OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0));
                 int [] order = new int [count];
-                OS.SendMessage (hwndHeader, OS.HDM_GETORDERARRAY, count, order);
+                OS.SendMessage (hwndHeader, OS.HDM_GETORDERARRAY, count, order.ptr);
                 while (index < count) {
-                    int hFont = item.cellFont !is null ? item.cellFont [order [index]] : -1;
-                    if (hFont is -1) hFont = item.font;
-                    if (hFont !is -1) hFont = OS.SelectObject (hDC, hFont);
+                    HFONT hFont = item.cellFont !is null ? item.cellFont [order [index]] : cast(HFONT)-1;
+                    if (hFont is cast(HFONT)-1) hFont = item.font;
+                    if (hFont !is cast(HFONT)-1) hFont = OS.SelectObject (hDC, hFont);
                     RECT cellRect = item.getBounds (order [index], true, false, true, false, true, hDC);
-                    if (hFont !is -1) OS.SelectObject (hDC, hFont);
+                    if (hFont !is cast(HFONT)-1) OS.SelectObject (hDC, hFont);
                     if (cellRect.left > rect.right) break;
                     cellRect.right = Math.min (cellRect.right, rect.right);
-                    if (OS.PtInRect (cellRect, pt)) {
+                    if (OS.PtInRect (&cellRect, pt)) {
                         RECT textRect = item.getBounds (order [index], true, false, false, false, false, hDC);
                         if (textRect.right > cellRect.right) {
-                            TOOLINFO lpti = new TOOLINFO ();
+                            TOOLINFO lpti;
                             lpti.cbSize = TOOLINFO.sizeof;
                             lpti.hwnd = handle;
-                            lpti.uId = handle;
+                            lpti.uId = cast(int) handle;
                             lpti.uFlags = OS.TTF_SUBCLASS | OS.TTF_TRANSPARENT;
-                            lpti.left = cellRect.left;
-                            lpti.top = cellRect.top;
-                            lpti.right = cellRect.right;
-                            lpti.bottom = cellRect.bottom;
-                            OS.SendMessage (itemToolTipHandle, OS.TTM_NEWTOOLRECT, 0, lpti);
+                            lpti.rect.left = cellRect.left;
+                            lpti.rect.top = cellRect.top;
+                            lpti.rect.right = cellRect.right;
+                            lpti.rect.bottom = cellRect.bottom;
+                            OS.SendMessage (itemToolTipHandle, OS.TTM_NEWTOOLRECT, 0, &lpti);
                         }
                         break;
                     }
                     index++;
                 }
-                if (newFont !is 0) OS.SelectObject (hDC, oldFont);
+                if (newFont !is null) OS.SelectObject (hDC, oldFont);
                 OS.ReleaseDC (handle, hDC);
             }
         }
@@ -6203,7 +6217,7 @@
 }
 
 override LRESULT WM_MOVE (int wParam, int lParam) {
-    if (ignoreResize) return null;
+    if (ignoreResize) return LRESULT.NULL;
     return super.WM_MOVE (wParam, lParam);
 }
 
@@ -6243,19 +6257,19 @@
     * calling the window proc and do the selection ourselves.
     * This behavior is consistent with the table.
     */
-    TVHITTESTINFO lpht = new TVHITTESTINFO ();
-    lpht.x = cast(short) (lParam & 0xFFFF);
-    lpht.y = cast(short) (lParam >> 16);
-    OS.SendMessage (handle, OS.TVM_HITTEST, 0, lpht);
-    if (lpht.hItem !is 0) {
+    TVHITTESTINFO lpht;
+    lpht.pt.x = cast(short) (lParam & 0xFFFF);
+    lpht.pt.y = cast(short) (lParam >> 16);
+    OS.SendMessage (handle, OS.TVM_HITTEST, 0, &lpht);
+    if (lpht.hItem !is null) {
         int flags = OS.TVHT_ONITEMICON | OS.TVHT_ONITEMLABEL;
         if ((style & DWT.FULL_SELECTION) !is 0 || (lpht.flags & flags) !is 0) {
             if ((wParam & (OS.MK_CONTROL | OS.MK_SHIFT)) is 0) {
-                TVITEM tvItem = new TVITEM ();
+                TVITEM tvItem;
                 tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_STATE;
                 tvItem.stateMask = OS.TVIS_SELECTED;
                 tvItem.hItem = lpht.hItem;
-                OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
+                OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem);
                 if ((tvItem.state & OS.TVIS_SELECTED) is 0) {
                     ignoreSelect = true;
                     OS.SendMessage (handle, OS.TVM_SELECTITEM, OS.TVGN_CARET, 0);
@@ -6295,44 +6309,44 @@
         }
         if (doubleBuffer) {
             GC gc = null;
-            int paintDC = 0;
-            PAINTSTRUCT ps = new PAINTSTRUCT ();
+            HDC paintDC;
+            PAINTSTRUCT ps;
             bool hooksPaint = hooks (DWT.Paint);
             if (hooksPaint) {
                 GCData data = new GCData ();
-                data.ps = ps;
+                data.ps = &ps;
                 data.hwnd = handle;
                 gc = GC.win32_new (this, data);
                 paintDC = gc.handle;
             } else {
-                paintDC = OS.BeginPaint (handle, ps);
-            }
-            int width = ps.right - ps.left;
-            int height = ps.bottom - ps.top;
+                paintDC = OS.BeginPaint (handle, &ps);
+            }
+            int width = ps.rcPaint.right - ps.rcPaint.left;
+            int height = ps.rcPaint.bottom - ps.rcPaint.top;
             if (width !is 0 && height !is 0) {
-                int hDC = OS.CreateCompatibleDC (paintDC);
-                POINT lpPoint1 = new POINT (), lpPoint2 = new POINT ();
-                OS.SetWindowOrgEx (hDC, ps.left, ps.top, lpPoint1);
-                OS.SetBrushOrgEx (hDC, ps.left, ps.top, lpPoint2);
-                int hBitmap = OS.CreateCompatibleBitmap (paintDC, width, height);
-                int hOldBitmap = OS.SelectObject (hDC, hBitmap);
-                RECT rect = new RECT ();
-                OS.SetRect (rect, ps.left, ps.top, ps.right, ps.bottom);
-                drawBackground (hDC, rect);
-                callWindowProc (handle, OS.WM_PAINT, hDC, 0);
+                auto hDC = OS.CreateCompatibleDC (paintDC);
+                POINT lpPoint1, lpPoint2;
+                OS.SetWindowOrgEx (hDC, ps.rcPaint.left, ps.rcPaint.top, &lpPoint1);
+                OS.SetBrushOrgEx (hDC, ps.rcPaint.left, ps.rcPaint.top, &lpPoint2);
+                auto hBitmap = OS.CreateCompatibleBitmap (paintDC, width, height);
+                auto hOldBitmap = OS.SelectObject (hDC, &hBitmap);
+                RECT rect;
+                OS.SetRect (&rect, ps.rcPaint.left, ps.rcPaint.top, ps.rcPaint.right, ps.rcPaint.bottom);
+                drawBackground (hDC, &rect);
+                callWindowProc (handle, OS.WM_PAINT, cast(int) hDC, 0);
                 OS.SetWindowOrgEx (hDC, lpPoint1.x, lpPoint1.y, null);
                 OS.SetBrushOrgEx (hDC, lpPoint2.x, lpPoint2.y, null);
-                OS.BitBlt (paintDC, ps.left, ps.top, width, height, hDC, 0, 0, OS.SRCCOPY);
+                OS.BitBlt (paintDC, ps.rcPaint.left, ps.rcPaint.top, width, height, hDC, 0, 0, OS.SRCCOPY);
                 OS.SelectObject (hDC, hOldBitmap);
                 OS.DeleteObject (hBitmap);
                 OS.DeleteObject (hDC);
                 if (hooksPaint) {
                     Event event = new Event ();
                     event.gc = gc;
-                    event.x = ps.left;
-                    event.y = ps.top;
-                    event.width = ps.right - ps.left;
-                    event.height = ps.bottom - ps.top;
+                    event.x = ps.rcPaint.left;
+                    event.y = ps.rcPaint.top;
+                    event.width = ps.rcPaint.right - ps.rcPaint.left;
+                    event.height = ps.rcPaint.bottom - ps.rcPaint.top;
                     sendEvent (DWT.Paint, event);
                     // widget could be disposed at this point
                     event.gc = null;
@@ -6341,7 +6355,7 @@
             if (hooksPaint) {
                 gc.dispose ();
             } else {
-                OS.EndPaint (handle, ps);
+                OS.EndPaint (handle, &ps);
             }
             return LRESULT.ZERO;
         }
@@ -6351,7 +6365,7 @@
 
 override LRESULT WM_PRINTCLIENT (int wParam, int lParam) {
     LRESULT result = super.WM_PRINTCLIENT (wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.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
@@ -6365,7 +6379,7 @@
     printClient = true;
     int code = callWindowProc (handle, OS.WM_PRINTCLIENT, wParam, lParam);
     printClient = false;
-    return new LRESULT (code);
+    return cast(LRESULT) (code);
 }
 
 override LRESULT WM_SETFOCUS (int wParam, int lParam) {
@@ -6400,8 +6414,8 @@
 
 override LRESULT WM_SETFONT (int wParam, int lParam) {
     LRESULT result = super.WM_SETFONT (wParam, lParam);
-    if (result !is null) return result;
-    if (hwndHeader !is 0) {
+    if (result !is LRESULT.NULL) return result;
+    if (hwndHeader !is null) {
         /*
         * Bug in Windows.  When a header has a sort indicator
         * triangle, Windows resizes the indicator based on the
@@ -6412,10 +6426,10 @@
         OS.SendMessage (hwndHeader, OS.WM_SETFONT, 0, lParam);
         OS.SendMessage (hwndHeader, OS.WM_SETFONT, wParam, lParam);
     }
-    if (itemToolTipHandle !is 0) {
+    if (itemToolTipHandle !is null) {
         OS.SendMessage (itemToolTipHandle, OS.WM_SETFONT, wParam, lParam);
     }
-    if (headerToolTipHandle !is 0) {
+    if (headerToolTipHandle !is null) {
         OS.SendMessage (headerToolTipHandle, OS.WM_SETFONT, wParam, lParam);
     }
     return result;
@@ -6423,7 +6437,7 @@
 
 override LRESULT WM_SETREDRAW (int wParam, int lParam) {
     LRESULT result = super.WM_SETREDRAW (wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     /*
     * Bug in Windows.  Under certain circumstances, when
     * WM_SETREDRAW is used to turn off drawing and then
@@ -6437,7 +6451,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 : new LRESULT (code);
+        return code is 0 ? LRESULT.ZERO : cast(LRESULT) (code);
     }
     return result;
 }
@@ -6467,13 +6481,13 @@
             }
         }
     }
-    if (ignoreResize) return null;
+    if (ignoreResize) return LRESULT.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 null) return result;
+    if (result !is LRESULT.NULL) return result;
     /*
     * Bug in Windows.  When the tree is using the explorer
     * theme, it does not use COLOR_WINDOW_TEXT for the
@@ -6492,7 +6506,7 @@
         if (OS.COMCTL32_MAJOR < 6) {
             return super.wmColorChild (wParam, lParam);
         }
-        return new LRESULT (OS.GetStockObject (OS.NULL_BRUSH));
+        return cast(LRESULT) (OS.GetStockObject (OS.NULL_BRUSH));
     }
     /*
     * Feature in Windows.  Tree controls send WM_CTLCOLOREDIT
@@ -6501,11 +6515,11 @@
     * and TVM_SETBKCOLOR, the documented way to do this.  The
     * fix is to ignore WM_CTLCOLOREDIT messages from trees.
     */
-    return null;
+    return LRESULT.NULL;
 }
 
 override LRESULT wmNotify (NMHDR* hdr, int wParam, int lParam) {
-    if (hdr.hwndFrom is itemToolTipHandle && hwndHeader !is 0) {
+    if (hdr.hwndFrom is itemToolTipHandle && hwndHeader !is null) {
         if (!OS.IsWinCE) {
             switch (hdr.code) {
                 case OS.TTN_POP: {
@@ -6521,49 +6535,49 @@
                         shell.lockToolTipControl = this;
                     }
                     int pos = OS.GetMessagePos ();
-                    POINT pt = new POINT();
+                    POINT pt;
                     pt.x = cast(short) (pos & 0xFFFF);
                     pt.y = cast(short) (pos >> 16);
-                    OS.ScreenToClient (handle, pt);
-                    TVHITTESTINFO lpht = new TVHITTESTINFO ();
-                    lpht.x = pt.x;
-                    lpht.y = pt.y;
-                    OS.SendMessage (handle, OS.TVM_HITTEST, 0, lpht);
-                    if (lpht.hItem !is 0) {
-                        int hDC = OS.GetDC (handle);
-                        int oldFont = 0, newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
-                        if (newFont !is 0) oldFont = OS.SelectObject (hDC, newFont);
-                        LRESULT result = null;
-                        RECT rect = new RECT ();
-                        OS.GetClientRect (hwndParent, rect);
-                        OS.MapWindowPoints (hwndParent, handle, rect, 2);
+                    OS.ScreenToClient (handle, &pt);
+                    TVHITTESTINFO lpht;
+                    lpht.pt.x = pt.x;
+                    lpht.pt.y = pt.y;
+                    OS.SendMessage (handle, OS.TVM_HITTEST, 0, &lpht);
+                    if (lpht.hItem !is null) {
+                        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;
+                        RECT rect;
+                        OS.GetClientRect (hwndParent, &rect);
+                        OS.MapWindowPoints (hwndParent, handle, cast(POINT*) &rect, 2);
                         TreeItem item = _getItem (lpht.hItem);
                         int index = 0, count = Math.max (1, OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0));
                         int [] order = new int [count];
-                        OS.SendMessage (hwndHeader, OS.HDM_GETORDERARRAY, count, order);
+                        OS.SendMessage (hwndHeader, OS.HDM_GETORDERARRAY, count, order.ptr);
                         while (index < count) {
-                            int hFont = item.cellFont !is null ? item.cellFont [order [index]] : -1;
-                            if (hFont is -1) hFont = item.font;
-                            if (hFont !is -1) hFont = OS.SelectObject (hDC, hFont);
+                            HFONT hFont = item.cellFont !is null ? item.cellFont [order [index]] : cast(HFONT)-1;
+                            if (hFont is cast(HFONT)-1) hFont = item.font;
+                            if (hFont !is cast(HFONT)-1) hFont = OS.SelectObject (hDC, hFont);
                             RECT cellRect = item.getBounds (order [index], true, false, true, false, true, hDC);
-                            if (hFont !is -1) OS.SelectObject (hDC, hFont);
+                            if (hFont !is cast(HFONT)-1) OS.SelectObject (hDC, hFont);
                             if (cellRect.left > rect.right) break;
                             cellRect.right = Math.min (cellRect.right, rect.right);
-                            if (OS.PtInRect (cellRect, pt)) {
+                            if (OS.PtInRect (&cellRect, pt)) {
                                 RECT textRect = item.getBounds (order [index], true, false, false, false, false, hDC);
                                 if (textRect.right > cellRect.right) {
-                                    OS.MapWindowPoints (handle, 0, textRect, 2);
+                                    OS.MapWindowPoints (handle, null, cast(POINT*) &textRect, 2);
                                     int flags = OS.SWP_NOACTIVATE | OS.SWP_NOSIZE | OS.SWP_NOZORDER;
-                                    SetWindowPos (itemToolTipHandle, 0, textRect.left, textRect.top, 0, 0, flags);
+                                    SetWindowPos (itemToolTipHandle, null, textRect.left, textRect.top, 0, 0, flags);
                                     result = LRESULT.ONE;
                                 }
                                 break;
                             }
                             index++;
                         }
-                        if (newFont !is 0) OS.SelectObject (hDC, oldFont);
+                        if (newFont !is null) OS.SelectObject (hDC, oldFont);
                         OS.ReleaseDC (handle, hDC);
-                        if (result !is null) return result;
+                        if (result !is LRESULT.NULL) return result;
                     }
                 }
             }
@@ -6589,8 +6603,8 @@
             case OS.HDN_BEGINTRACKA:
             case OS.HDN_DIVIDERDBLCLICKW:
             case OS.HDN_DIVIDERDBLCLICKA: {
-                NMHEADER phdn = new NMHEADER ();
-                OS.MoveMemory (phdn, lParam, NMHEADER.sizeof);
+                NMHEADER* phdn = cast(NMHEADER*)lParam;
+                //OS.MoveMemory (phdn, lParam, NMHEADER.sizeof);
                 TreeColumn column = columns [phdn.iItem];
                 if (column !is null && !column.getResizable ()) {
                     return LRESULT.ONE;
@@ -6617,8 +6631,8 @@
             }
             case OS.HDN_BEGINDRAG: {
                 if (ignoreColumnMove) return LRESULT.ONE;
-                NMHEADER phdn = new NMHEADER ();
-                OS.MoveMemory (phdn, lParam, NMHEADER.sizeof);
+                NMHEADER* phdn = cast(NMHEADER*)lParam;
+                //OS.MoveMemory (phdn, lParam, NMHEADER.sizeof);
                 if (phdn.iItem !is -1) {
                     TreeColumn column = columns [phdn.iItem];
                     if (column !is null && !column.getMoveable ()) {
@@ -6629,15 +6643,15 @@
                 break;
             }
             case OS.HDN_ENDDRAG: {
-                NMHEADER phdn = new NMHEADER ();
-                OS.MoveMemory (phdn, lParam, NMHEADER.sizeof);
-                if (phdn.iItem !is -1 && phdn.pitem !is 0) {
-                    HDITEM pitem = new HDITEM ();
-                    OS.MoveMemory (pitem, phdn.pitem, HDITEM.sizeof);
+                NMHEADER* phdn = cast(NMHEADER*)lParam;
+                //OS.MoveMemory (phdn, lParam, NMHEADER.sizeof);
+                if (phdn.iItem !is -1 && phdn.pitem !is null) {
+                    HDITEM* pitem = phdn.pitem;
+                    //OS.MoveMemory (pitem, phdn.pitem, HDITEM.sizeof);
                     if ((pitem.mask & OS.HDI_ORDER) !is 0 && pitem.iOrder !is -1) {
                         int count = OS.SendMessage (hwndHeader, OS.HDM_GETITEMCOUNT, 0, 0);
                         int [] order = new int [count];
-                        OS.SendMessage (hwndHeader, OS.HDM_GETORDERARRAY, count, order);
+                        OS.SendMessage (hwndHeader, OS.HDM_GETORDERARRAY, count, order.ptr);
                         int index = 0;
                         while (index < order.length) {
                             if (order [index] is phdn.iItem) break;
@@ -6647,13 +6661,13 @@
                         if (index is pitem.iOrder) break;
                         int start = Math.min (index, pitem.iOrder);
                         int end = Math.max (index, pitem.iOrder);
-                        RECT rect = new RECT (), headerRect = new RECT ();
-                        OS.GetClientRect (handle, rect);
-                        OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, order [start], headerRect);
+                        RECT rect, headerRect;
+                        OS.GetClientRect (handle, &rect);
+                        OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, order [start], &headerRect);
                         rect.left = Math.max (rect.left, headerRect.left);
-                        OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, order [end], headerRect);
+                        OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, order [end], &headerRect);
                         rect.right = Math.min (rect.right, headerRect.right);
-                        OS.InvalidateRect (handle, rect, true);
+                        OS.InvalidateRect (handle, &rect, true);
                         ignoreColumnMove = false;
                         for (int i=start; i<=end; i++) {
                             TreeColumn column = columns [order [i]];
@@ -6667,36 +6681,36 @@
             }
             case OS.HDN_ITEMCHANGINGW:
             case OS.HDN_ITEMCHANGINGA: {
-                NMHEADER phdn = new NMHEADER ();
-                OS.MoveMemory (phdn, lParam, NMHEADER.sizeof);
-                if (phdn.pitem !is 0) {
-                    HDITEM newItem = new HDITEM ();
-                    OS.MoveMemory (newItem, phdn.pitem, HDITEM.sizeof);
+                NMHEADER* phdn = cast(NMHEADER*)lParam;
+                //OS.MoveMemory (phdn, lParam, NMHEADER.sizeof);
+                if (phdn.pitem !is null) {
+                    HDITEM* newItem = phdn.pitem;
+                    //OS.MoveMemory (newItem, phdn.pitem, HDITEM.sizeof);
                     if ((newItem.mask & OS.HDI_WIDTH) !is 0) {
-                        RECT rect = new RECT ();
-                        OS.GetClientRect (handle, rect);
-                        HDITEM oldItem = new HDITEM ();
+                        RECT rect;
+                        OS.GetClientRect (handle, &rect);
+                        HDITEM oldItem;
                         oldItem.mask = OS.HDI_WIDTH;
-                        OS.SendMessage (hwndHeader, OS.HDM_GETITEM, phdn.iItem, oldItem);
+                        OS.SendMessage (hwndHeader, OS.HDM_GETITEM, phdn.iItem, &oldItem);
                         int deltaX = newItem.cxy - oldItem.cxy;
-                        RECT headerRect = new RECT ();
-                        OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, phdn.iItem, headerRect);
+                        RECT headerRect;
+                        OS.SendMessage (hwndHeader, OS.HDM_GETITEMRECT, phdn.iItem, &headerRect);
                         int gridWidth = linesVisible ? GRID_WIDTH : 0;
                         rect.left = headerRect.right - gridWidth;
                         int newX = rect.left + deltaX;
                         rect.right = Math.max (rect.right, rect.left + Math.abs (deltaX));
                         if (explorerTheme || (findImageControl () !is null || hooks (DWT.EraseItem) || hooks (DWT.PaintItem))) {
-                            OS.InvalidateRect (handle, rect, true);
-                            OS.OffsetRect (rect, deltaX, 0);
-                            OS.InvalidateRect (handle, rect, true);
+                            OS.InvalidateRect (handle, &rect, true);
+                            OS.OffsetRect (&rect, deltaX, 0);
+                            OS.InvalidateRect (handle, &rect, true);
                         } else {
                             int flags = OS.SW_INVALIDATE | OS.SW_ERASE;
-                            OS.ScrollWindowEx (handle, deltaX, 0, rect, null, 0, null, flags);
+                            OS.ScrollWindowEx (handle, deltaX, 0, &rect, null, null, null, flags);
                         }
                         if (OS.SendMessage (hwndHeader, OS.HDM_ORDERTOINDEX, phdn.iItem, 0) !is 0) {
                             rect.left = headerRect.left;
                             rect.right = newX;
-                            OS.InvalidateRect (handle, rect, true);
+                            OS.InvalidateRect (handle, &rect, true);
                         }
                         setScrollWidth ();
                     }
@@ -6705,16 +6719,16 @@
             }
             case OS.HDN_ITEMCHANGEDW:
             case OS.HDN_ITEMCHANGEDA: {
-                NMHEADER phdn = new NMHEADER ();
-                OS.MoveMemory (phdn, lParam, NMHEADER.sizeof);
-                if (phdn.pitem !is 0) {
-                    HDITEM pitem = new HDITEM ();
-                    OS.MoveMemory (pitem, phdn.pitem, HDITEM.sizeof);
+                NMHEADER* phdn = cast(NMHEADER*)lParam;
+                //OS.MoveMemory (phdn, lParam, NMHEADER.sizeof);
+                if (phdn.pitem !is null) {
+                    HDITEM* pitem = phdn.pitem;
+                    //OS.MoveMemory (pitem, phdn.pitem, HDITEM.sizeof);
                     if ((pitem.mask & OS.HDI_WIDTH) !is 0) {
                         if (ignoreColumnMove) {
                             if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
                                 int flags = OS.RDW_UPDATENOW | OS.RDW_ALLCHILDREN;
-                                OS.RedrawWindow (handle, null, 0, flags);
+                                OS.RedrawWindow (handle, null, null, flags);
                             } else {
                                 if ((style & DWT.DOUBLE_BUFFERED) is 0) {
                                     int oldStyle = style;
@@ -6733,7 +6747,7 @@
                             TreeColumn [] newColumns = new TreeColumn [count];
                             System.arraycopy (columns, 0, newColumns, 0, count);
                             int [] order = new int [count];
-                            OS.SendMessage (hwndHeader, OS.HDM_GETORDERARRAY, count, order);
+                            OS.SendMessage (hwndHeader, OS.HDM_GETORDERARRAY, count, order.ptr);
                             bool moved = false;
                             for (int i=0; i<count; i++) {
                                 TreeColumn nextColumn = newColumns [order [i]];
@@ -6751,8 +6765,8 @@
             }
             case OS.HDN_ITEMCLICKW:
             case OS.HDN_ITEMCLICKA: {
-                NMHEADER phdn = new NMHEADER ();
-                OS.MoveMemory (phdn, lParam, NMHEADER.sizeof);
+                NMHEADER* phdn = cast(NMHEADER*)lParam;
+                //OS.MoveMemory (phdn, lParam, NMHEADER.sizeof);
                 TreeColumn column = columns [phdn.iItem];
                 if (column !is null) {
                     column.postEvent (DWT.Selection);
@@ -6761,8 +6775,8 @@
             }
             case OS.HDN_ITEMDBLCLICKW:
             case OS.HDN_ITEMDBLCLICKA: {
-                NMHEADER phdn = new NMHEADER ();
-                OS.MoveMemory (phdn, lParam, NMHEADER.sizeof);
+                NMHEADER* phdn = cast(NMHEADER*)lParam;
+                //OS.MoveMemory (phdn, lParam, NMHEADER.sizeof);
                 TreeColumn column = columns [phdn.iItem];
                 if (column !is null) {
                     column.postEvent (DWT.DefaultSelection);
@@ -6778,8 +6792,8 @@
     switch (hdr.code) {
         case OS.TVN_GETDISPINFOA:
         case OS.TVN_GETDISPINFOW: {
-            NMTVDISPINFO lptvdi = new NMTVDISPINFO ();
-            OS.MoveMemory (lptvdi, lParam, NMTVDISPINFO.sizeof);
+            NMTVDISPINFO* lptvdi = cast(NMTVDISPINFO*)lParam;
+            //OS.MoveMemory (lptvdi, lParam, NMTVDISPINFO.sizeof);
             if ((style & DWT.VIRTUAL) !is 0) {
                 /*
                 * Feature in Windows.  When a new tree item is inserted
@@ -6801,24 +6815,24 @@
                 * right away, queue a redraw for later.
                 */
                 if (!ignoreShrink) {
-                    if (items !is null && lptvdi.lParam !is -1) {
-                        if (items [lptvdi.lParam] !is null && items [lptvdi.lParam].cached) {
+                    if (items !is null && lptvdi.item.lParam !is -1) {
+                        if (items [lptvdi.item.lParam] !is null && items [lptvdi.item.lParam].cached) {
                             checkVisible = false;
                         }
                     }
                 }
                 if (checkVisible) {
                     if (drawCount !is 0 || !OS.IsWindowVisible (handle)) break;
-                    RECT itemRect = new RECT ();
-                    itemRect.left = lptvdi.hItem;
-                    if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, itemRect) is 0) {
+                    RECT itemRect;
+                    itemRect.left = cast(int) lptvdi.item.hItem;
+                    if (OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, &itemRect) is 0) {
                         break;
                     }
-                    RECT rect = new RECT ();
-                    OS.GetClientRect (handle, rect);
-                    if (!OS.IntersectRect (rect, rect, itemRect)) break;
+                    RECT rect;
+                    OS.GetClientRect (handle, &rect);
+                    if (!OS.IntersectRect (&rect, &rect, &itemRect)) break;
                     if (ignoreShrink) {
-                        OS.InvalidateRect (handle, rect, true);
+                        OS.InvalidateRect (handle, &rect, true);
                         break;
                     }
                 }
@@ -6832,17 +6846,17 @@
             * fix is to query the field from the item instead
             * of using the struct.
             */
-            int id = lptvdi.lParam;
+            int id = lptvdi.item.lParam;
             if ((style & DWT.VIRTUAL) !is 0) {
                 if (id is -1) {
-                    TVITEM tvItem = new TVITEM ();
+                    TVITEM tvItem;
                     tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM;
-                    tvItem.hItem = lptvdi.hItem;
-                    OS.SendMessage (handle, OS.TVM_GETITEM, 0, tvItem);
+                    tvItem.hItem = lptvdi.item.hItem;
+                    OS.SendMessage (handle, OS.TVM_GETITEM, 0, &tvItem);
                     id = tvItem.lParam;
                 }
             }
-            TreeItem item = _getItem (lptvdi.hItem, id);
+            TreeItem item = _getItem (lptvdi.item.hItem, id);
             /*
             * Feature in Windows.  When a new tree item is inserted
             * using TVM_INSERTITEM, a TVN_GETDISPINFO is sent before
@@ -6867,10 +6881,10 @@
                 if (painted) item.cached = true;
             }
             int index = 0;
-            if (hwndHeader !is 0) {
+            if (hwndHeader !is null) {
                 index = OS.SendMessage (hwndHeader, OS.HDM_ORDERTOINDEX, 0, 0);
             }
-            if ((lptvdi.mask & OS.TVIF_TEXT) !is 0) {
+            if ((lptvdi.item.mask & OS.TVIF_TEXT) !is 0) {
                 char[] string = null;
                 if (index is 0) {
                     string = item.text;
@@ -6879,14 +6893,16 @@
                     if (strings !is null) string = strings [index];
                 }
                 if (string !is null) {
-                    TCHAR buffer = new TCHAR (getCodePage (), string, false);
-                    int byteCount = Math.min (buffer.length (), lptvdi.cchTextMax - 1) * TCHAR.sizeof;
-                    OS.MoveMemory (lptvdi.pszText, buffer, byteCount);
-                    OS.MoveMemory (lptvdi.pszText + byteCount, new byte [TCHAR.sizeof], TCHAR.sizeof);
-                    lptvdi.cchTextMax = Math.min (lptvdi.cchTextMax, string.length () + 1);
+                    TCHAR[] buffer = StrToTCHARs (getCodePage (), string, false);
+                    int byteCount = Math.min (buffer.length, lptvdi.item.cchTextMax - 1) * TCHAR.sizeof;
+                    OS.MoveMemory (lptvdi.item.pszText, buffer.ptr, byteCount);
+                    int st = byteCount/TCHAR.sizeof;
+                    lptvdi.item.pszText[ st .. st+1 ] = 0;
+                    //OS.MoveMemory (lptvdi.pszText + byteCount, new byte [TCHAR.sizeof], TCHAR.sizeof);
+                    lptvdi.item.cchTextMax = Math.min (lptvdi.item.cchTextMax, string.length + 1);
                 }
             }
-            if ((lptvdi.mask & (OS.TVIF_IMAGE | OS.TVIF_SELECTEDIMAGE)) !is 0) {
+            if ((lptvdi.item.mask & (OS.TVIF_IMAGE | OS.TVIF_SELECTEDIMAGE)) !is 0) {
                 Image image = null;
                 if (index is 0) {
                     image = item.image;
@@ -6894,23 +6910,23 @@
                     Image [] images  = item.images;
                     if (images !is null) image = images [index];
                 }
-                lptvdi.iImage = lptvdi.iSelectedImage = OS.I_IMAGENONE;
+                lptvdi.item.iImage = lptvdi.item.iSelectedImage = OS.I_IMAGENONE;
                 if (image !is null) {
-                    lptvdi.iImage = lptvdi.iSelectedImage = imageIndex (image, index);
+                    lptvdi.item.iImage = lptvdi.item.iSelectedImage = imageIndex (image, index);
                 }
                 if (explorerTheme && OS.IsWindowEnabled (handle)) {
                     if (findImageControl () !is null) {
-                        lptvdi.iImage = lptvdi.iSelectedImage = OS.I_IMAGENONE;
+                        lptvdi.item.iImage = lptvdi.item.iSelectedImage = OS.I_IMAGENONE;
                     }
                 }
             }
-            OS.MoveMemory (lParam, lptvdi, NMTVDISPINFO.sizeof);
+            //OS.MoveMemory (cast(void*)lParam, lptvdi, NMTVDISPINFO.sizeof);
             break;
         }
         case OS.NM_CUSTOMDRAW: {
             if (hdr.hwndFrom is hwndHeader) break;
             if (hooks (DWT.MeasureItem)) {
-                if (hwndHeader is 0) createParent ();
+                if (hwndHeader is null) createParent ();
             }
             if (!customDraw && findImageControl () is null) {
                 if (OS.COMCTL32_MAJOR >= 6 && OS.IsAppThemed ()) {
@@ -6919,9 +6935,9 @@
                     }
                 }
             }
-            NMTVCUSTOMDRAW nmcd = new NMTVCUSTOMDRAW ();
-            OS.MoveMemory (nmcd, lParam, NMTVCUSTOMDRAW.sizeof);
-            switch (nmcd.dwDrawStage) {
+            NMTVCUSTOMDRAW* nmcd = cast(NMTVCUSTOMDRAW*)lParam;
+            //OS.MoveMemory (nmcd, lParam, NMTVCUSTOMDRAW.sizeof);
+            switch (nmcd.nmcd.dwDrawStage) {
                 case OS.CDDS_PREPAINT: return CDDS_PREPAINT (nmcd, wParam, lParam);
                 case OS.CDDS_ITEMPREPAINT: return CDDS_ITEMPREPAINT (nmcd, wParam, lParam);
                 case OS.CDDS_ITEMPOSTPAINT: return CDDS_ITEMPOSTPAINT (nmcd, wParam, lParam);
@@ -6941,16 +6957,16 @@
             * the mouse was inside a tree item.
             */
             if (hooks (DWT.DefaultSelection)) {
-                POINT pt = new POINT ();
+                POINT pt;
                 int pos = OS.GetMessagePos ();
                 pt.x = cast(short) (pos & 0xFFFF);
                 pt.y = cast(short) (pos >> 16);
-                OS.ScreenToClient (handle, pt);
-                TVHITTESTINFO lpht = new TVHITTESTINFO ();
-                lpht.x = pt.x;
-                lpht.y = pt.y;
-                OS.SendMessage (handle, OS.TVM_HITTEST, 0, lpht);
-                if (lpht.hItem !is 0 && (lpht.flags & OS.TVHT_ONITEM) !is 0) {
+                OS.ScreenToClient (handle, &pt);
+                TVHITTESTINFO lpht;
+                lpht.pt.x = pt.x;
+                lpht.pt.y = pt.y;
+                OS.SendMessage (handle, OS.TVM_HITTEST, 0, &lpht);
+                if (lpht.hItem !is null && (lpht.flags & OS.TVHT_ONITEM) !is 0) {
                     return LRESULT.ONE;
                 }
             }
@@ -6968,9 +6984,9 @@
         case OS.TVN_ITEMCHANGINGW: {
             if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
                 if ((style & DWT.MULTI) !is 0) {
-                    if (hSelect !is 0) {
-                        NMTVITEMCHANGE pnm = new NMTVITEMCHANGE ();
-                        OS.MoveMemory (pnm, lParam, NMTVITEMCHANGE.sizeof);
+                    if (hSelect !is null) {
+                        NMTVITEMCHANGE* pnm = cast(NMTVITEMCHANGE*)lParam;
+                        //OS.MoveMemory (pnm, lParam, NMTVITEMCHANGE.sizeof);
                         if (hSelect is pnm.hItem) break;
                         return LRESULT.ONE;
                     }
@@ -6983,17 +6999,17 @@
             if ((style & DWT.MULTI) !is 0) {
                 if (lockSelection) {
                     /* Save the old selection state for both items */
-                    TVITEM tvItem = new TVITEM ();
+                    TVITEM tvItem;
                     int offset1 = NMHDR.sizeof + 4;
-                    OS.MoveMemory (tvItem, lParam + offset1, TVITEM.sizeof);
+                    OS.MoveMemory (&tvItem, lParam + offset1, TVITEM.sizeof);
                     oldSelected = (tvItem.state & OS.TVIS_SELECTED) !is 0;
                     int offset2 = NMHDR.sizeof + 4 + TVITEM.sizeof;
-                    OS.MoveMemory (tvItem, lParam + offset2, TVITEM.sizeof);
+                    OS.MoveMemory (&tvItem, lParam + offset2, TVITEM.sizeof);
                     newSelected = (tvItem.state & OS.TVIS_SELECTED) !is 0;
                 }
             }
             if (!ignoreSelect && !ignoreDeselect) {
-                hAnchor = 0;
+                hAnchor = null;
                 if ((style & DWT.MULTI) !is 0) deselectAll ();
             }
             break;
@@ -7004,32 +7020,32 @@
                 if (lockSelection) {
                     /* Restore the old selection state of both items */
                     if (oldSelected) {
-                        TVITEM tvItem = new TVITEM ();
+                        TVITEM tvItem;
                         int offset = NMHDR.sizeof + 4;
-                        OS.MoveMemory (tvItem, lParam + offset, TVITEM.sizeof);
+                        OS.MoveMemory (&tvItem, lParam + offset, TVITEM.sizeof);
                         tvItem.mask = OS.TVIF_STATE;
                         tvItem.stateMask = OS.TVIS_SELECTED;
                         tvItem.state = OS.TVIS_SELECTED;
-                        OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
+                        OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
                     }
                     if (!newSelected && ignoreSelect) {
-                        TVITEM tvItem = new TVITEM ();
+                        TVITEM tvItem;
                         int offset = NMHDR.sizeof + 4 + TVITEM.sizeof;
-                        OS.MoveMemory (tvItem, lParam + offset, TVITEM.sizeof);
+                        OS.MoveMemory (&tvItem, lParam + offset, TVITEM.sizeof);
                         tvItem.mask = OS.TVIF_STATE;
                         tvItem.stateMask = OS.TVIS_SELECTED;
                         tvItem.state = 0;
-                        OS.SendMessage (handle, OS.TVM_SETITEM, 0, tvItem);
+                        OS.SendMessage (handle, OS.TVM_SETITEM, 0, &tvItem);
                     }
                 }
             }
             if (!ignoreSelect) {
-                TVITEM tvItem = new TVITEM ();
+                TVITEM tvItem;
                 int offset = NMHDR.sizeof + 4 + TVITEM.sizeof;
-                OS.MoveMemory (tvItem, lParam + offset, TVITEM.sizeof);
+                OS.MoveMemory (&tvItem, lParam + offset, TVITEM.sizeof);
                 hAnchor = tvItem.hItem;
                 Event event = new Event ();
-                event.item = _getItem (tvItem.hItem, tvItem.lParam);
+                event.item = _getItem (&tvItem.hItem, tvItem.lParam);
                 postEvent (DWT.Selection, event);
             }
             updateScrollBar ();
@@ -7050,13 +7066,13 @@
             * the insert mark properly.  The fix is to hide and show
             * the insert mark whenever an item is expanded or collapsed.
             */
-            if (hInsert !is 0) {
+            if (hInsert !is null) {
                 OS.SendMessage (handle, OS.TVM_SETINSERTMARK, 0, 0);
             }
             if (!ignoreExpand) {
-                TVITEM tvItem = new TVITEM ();
+                TVITEM tvItem;
                 int offset = NMHDR.sizeof + 4 + TVITEM.sizeof;
-                OS.MoveMemory (tvItem, lParam + offset, TVITEM.sizeof);
+                OS.MoveMemory (&tvItem, lParam + offset, TVITEM.sizeof);
                 /*
                 * Feature in Windows.  In some cases, TVM_ITEMEXPANDING
                 * is sent from within TVM_DELETEITEM for the tree item
@@ -7069,9 +7085,9 @@
                 if (item is null) break;
                 Event event = new Event ();
                 event.item = item;
-                int [] action = new int [1];
-                OS.MoveMemory (action, lParam + NMHDR.sizeof, 4);
-                switch (action [0]) {
+                int action = *cast(int*)(lParam + NMHDR.sizeof);
+                //OS.MoveMemory (action, lParam + NMHDR.sizeof, 4);
+                switch (action) {
                     case OS.TVE_EXPAND:
                         /*
                         * Bug in Windows.  When the numeric keypad asterisk
@@ -7097,8 +7113,8 @@
                 * The fix is to detect this case and run the TVN_ITEMEXPANDED
                 * code in this method.
                 */
-                int hFirstItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, tvItem.hItem);
-                runExpanded = hFirstItem is 0;
+                auto hFirstItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, tvItem.hItem);
+                runExpanded = hFirstItem is null;
             }
             if (!runExpanded) break;
             //FALL THROUGH
@@ -7118,7 +7134,7 @@
             * the insert mark properly.  The fix is to hide and show
             * the insert mark whenever an item is expanded or collapsed.
             */
-            if (hInsert !is 0) {
+            if (hInsert !is null) {
                 OS.SendMessage (handle, OS.TVM_SETINSERTMARK, insertAfter ? 1 : 0, hInsert);
             }
             /*
@@ -7130,16 +7146,16 @@
             */
             if (!OS.IsWinCE && OS.COMCTL32_MAJOR >= 6) {
                 if (imageList !is null) {
-                    TVITEM tvItem = new TVITEM ();
+                    TVITEM tvItem;
                     int offset = NMHDR.sizeof + 4 + TVITEM.sizeof;
-                    OS.MoveMemory (tvItem, lParam + offset, TVITEM.sizeof);
-                    if (tvItem.hItem !is 0) {
+                    OS.MoveMemory (&tvItem, lParam + offset, TVITEM.sizeof);
+                    if (tvItem.hItem !is null) {
                         int bits = OS.GetWindowLong (handle, OS.GWL_STYLE);
                         if ((bits & OS.TVS_FULLROWSELECT) is 0) {
-                            RECT rect = new RECT ();
-                            rect.left = tvItem.hItem;
-                            OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, rect);
-                            OS.InvalidateRect (handle, rect, true);
+                            RECT rect;
+                            rect.left = cast(int)tvItem.hItem;
+                            OS.SendMessage (handle, OS.TVM_GETITEMRECT, 0, &rect);
+                            OS.InvalidateRect (handle, &rect, true);
                         }
                     }
                 }
@@ -7151,15 +7167,15 @@
         case OS.TVN_BEGINDRAGW:
         case OS.TVN_BEGINRDRAGA:
         case OS.TVN_BEGINRDRAGW: {
-            TVITEM tvItem = new TVITEM ();
+            TVITEM tvItem;
             int offset = NMHDR.sizeof + 4 + TVITEM.sizeof;
-            OS.MoveMemory (tvItem, lParam + offset, TVITEM.sizeof);
-            if (tvItem.hItem !is 0 && (tvItem.state & OS.TVIS_SELECTED) is 0) {
+            OS.MoveMemory (&tvItem, lParam + offset, TVITEM.sizeof);
+            if (tvItem.hItem !is null && (tvItem.state & OS.TVIS_SELECTED) is 0) {
                 hSelect = tvItem.hItem;
                 ignoreSelect = ignoreDeselect = true;
                 OS.SendMessage (handle, OS.TVM_SELECTITEM, OS.TVGN_CARET, tvItem.hItem);
                 ignoreSelect = ignoreDeselect = false;
-                hSelect = 0;
+                hSelect = null;
             }
             dragStarted = true;
             break;
@@ -7174,18 +7190,18 @@
             * TRUE when receiving the Pocket PC 2002 specific NM_RECOGNIZEGESTURE
             * message.
             */
-            if (OS.IsPPC) {
+            if (OS.IsPPC_) {
                 bool hasMenu = menu !is null && !menu.isDisposed ();
                 if (!hasMenu && !hooks (DWT.MenuDetect)) return LRESULT.ONE;
             }
             break;
         }
         case OS.GN_CONTEXTMENU: {
-            if (OS.IsPPC) {
+            if (OS.IsPPC_) {
                 bool hasMenu = menu !is null && !menu.isDisposed ();
                 if (hasMenu || hooks (DWT.MenuDetect)) {
-                    NMRGINFO nmrg = new NMRGINFO ();
-                    OS.MoveMemory (nmrg, lParam, NMRGINFO.sizeof);
+                    NMRGINFO* nmrg = cast(NMRGINFO*)lParam;
+                    //OS.MoveMemory (nmrg, lParam, NMRGINFO.sizeof);
                     showMenu (nmrg.x, nmrg.y);
                     gestureCompleted = true;
                     return LRESULT.ONE;
--- a/dwt/widgets/TreeItem.d	Tue Feb 05 00:15:31 2008 +0100
+++ b/dwt/widgets/TreeItem.d	Tue Feb 05 03:50:39 2008 +0100
@@ -791,8 +791,8 @@
     checkWidget ();
     if (!parent.checkData (this, true)) error (DWT.ERROR_WIDGET_DISPOSED);
     auto hwnd = parent.handle;
-    int hItem = OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, handle);
-    if (hItem is 0) return new TreeItem [0];
+    auto hItem = cast(HANDLE) OS.SendMessage (hwnd, OS.TVM_GETNEXTITEM, OS.TVGN_CHILD, handle);
+    if (hItem is null) return null;
     return parent.getItems (hItem);
 }
 
--- a/tango_sys_win32/Types.di	Tue Feb 05 00:15:31 2008 +0100
+++ b/tango_sys_win32/Types.di	Tue Feb 05 03:50:39 2008 +0100
@@ -4148,7 +4148,7 @@
 {
 }
 
-alias TREEITEM* HTREEITEM;
+alias HANDLE HTREEITEM;
 alias TREEITEM TTREEITEM;
 alias TREEITEM* PTREEITEM;
 enum : DWORD {
@@ -9609,6 +9609,7 @@
 
 alias HD_LAYOUT _HD_LAYOUT;
 alias HD_LAYOUT THDLAYOUT;
+alias HD_LAYOUT  HDLAYOUT;
 alias HD_LAYOUT* PHDLAYOUT;
 
 struct HD_NOTIFY
@@ -10871,38 +10872,38 @@
 alias NM_LISTVIEW TNMLISTVIEW;
 alias NM_LISTVIEW* PNMLISTVIEW;
 
-struct TV_ITEM
-{
-	UINT mask;
-	HTREEITEM hItem;
-	UINT state;
-	UINT stateMask;
-	LPTSTR pszText;
-	int cchTextMax;
-	int iImage;
-	int iSelectedImage;
-	int cChildren;
-	LPARAM lParam;
-}
-
-alias TV_ITEM* LPTV_ITEM;
-alias TV_ITEM _TV_ITEM;
-alias TV_ITEM TTVITEM;
-alias TV_ITEM* PTVITEM;
-
-struct NM_TREEVIEW
-{
-	NMHDR hdr;
-	UINT action;
-	TV_ITEM itemOld;
-	TV_ITEM itemNew;
-	POINT ptDrag;
-}
-
-alias NM_TREEVIEW* LPNM_TREEVIEW;
-alias NM_TREEVIEW _NM_TREEVIEW;
-alias NM_TREEVIEW TNMTREEVIEW;
-alias NM_TREEVIEW* PNMTREEVIEW;
+// struct TV_ITEM
+// {
+// 	UINT mask;
+// 	HTREEITEM hItem;
+// 	UINT state;
+// 	UINT stateMask;
+// 	LPTSTR pszText;
+// 	int cchTextMax;
+// 	int iImage;
+// 	int iSelectedImage;
+// 	int cChildren;
+// 	LPARAM lParam;
+// }
+//
+// alias TV_ITEM* LPTV_ITEM;
+// alias TV_ITEM _TV_ITEM;
+// alias TV_ITEM TTVITEM;
+// alias TV_ITEM* PTVITEM;
+
+// struct NM_TREEVIEW
+// {
+// 	NMHDR hdr;
+// 	UINT action;
+// 	TV_ITEM itemOld;
+// 	TV_ITEM itemNew;
+// 	POINT ptDrag;
+// }
+//
+// alias NM_TREEVIEW* LPNM_TREEVIEW;
+// alias NM_TREEVIEW _NM_TREEVIEW;
+// alias NM_TREEVIEW TNMTREEVIEW;
+// alias NM_TREEVIEW* PNMTREEVIEW;
 
 struct NM_UPDOWNW
 {
@@ -12827,62 +12828,63 @@
 alias TTPOLYGONHEADER TTTPOLYGONHEADER;
 alias TTPOLYGONHEADER* PTTPOLYGONHEADER;
 
-struct TV_DISPINFO
-{
-	NMHDR hdr;
-	TV_ITEM item;
-}
-
-alias TV_DISPINFO _TV_DISPINFO;
-alias TV_DISPINFO TTVDISPINFO;
-alias TV_DISPINFO* PTVDISPINFO;
-
-struct TV_HITTESTINFO
-{
-	POINT pt;
-	UINT flags;
-	HTREEITEM hItem;
-}
-
-alias TV_HITTESTINFO* LPTV_HITTESTINFO;
-alias TV_HITTESTINFO _TVHITTESTINFO;
-alias TV_HITTESTINFO TTVHITTESTINFO;
-alias TV_HITTESTINFO* PTVHITTESTINFO;
-
-struct TV_INSERTSTRUCT
-{
-	HTREEITEM hParent;
-	HTREEITEM hInsertAfter;
-	TV_ITEM item;
-}
-
-alias TV_INSERTSTRUCT* LPTV_INSERTSTRUCT;
-alias TV_INSERTSTRUCT _TV_INSERTSTRUCT;
-alias TV_INSERTSTRUCT TTVINSERTSTRUCT;
-alias TV_INSERTSTRUCT* PTVINSERTSTRUCT;
-
-struct TV_KEYDOWN
-{
-	NMHDR hdr;
-	ushort wVKey;
-	UINT flags;
-}
-
-alias TV_KEYDOWN _TV_KEYDOWN;
-alias TV_KEYDOWN TTVKEYDOWN;
-alias TV_KEYDOWN* PTVKEYDOWN;
-
-struct TV_SORTCB
-{
-	HTREEITEM hParent;
-	PFNTVCOMPARE lpfnCompare;
-	LPARAM lParam;
-}
-
-alias TV_SORTCB* LPTV_SORTCB;
-alias TV_SORTCB _TV_SORTCB;
-alias TV_SORTCB TTVSORTCB;
-alias TV_SORTCB* PTVSORTCB;
+// struct TV_DISPINFO
+// {
+// 	NMHDR hdr;
+// 	TV_ITEM item;
+// }
+//
+// alias TV_DISPINFO _TV_DISPINFO;
+// alias TV_DISPINFO TTVDISPINFO;
+// alias TV_DISPINFO* PTVDISPINFO;
+//
+// struct TV_HITTESTINFO
+// {
+// 	POINT pt;
+// 	UINT flags;
+// 	HTREEITEM hItem;
+// }
+//
+// alias TV_HITTESTINFO* LPTV_HITTESTINFO;
+// alias TV_HITTESTINFO _TVHITTESTINFO;
+// alias TV_HITTESTINFO TTVHITTESTINFO;
+// alias TV_HITTESTINFO* PTVHITTESTINFO;
+//
+// struct TV_INSERTSTRUCT
+// {
+// 	HTREEITEM hParent;
+// 	HTREEITEM hInsertAfter;
+// 	TV_ITEM item;
+// }
+//
+// alias TV_INSERTSTRUCT* LPTV_INSERTSTRUCT;
+// alias TV_INSERTSTRUCT _TV_INSERTSTRUCT;
+// alias TV_INSERTSTRUCT TTVINSERTSTRUCT;
+// alias TV_INSERTSTRUCT  TVINSERTSTRUCT;
+// alias TV_INSERTSTRUCT* PTVINSERTSTRUCT;
+//
+// struct TV_KEYDOWN
+// {
+// 	NMHDR hdr;
+// 	ushort wVKey;
+// 	UINT flags;
+// }
+//
+// alias TV_KEYDOWN _TV_KEYDOWN;
+// alias TV_KEYDOWN TTVKEYDOWN;
+// alias TV_KEYDOWN* PTVKEYDOWN;
+//
+// struct TV_SORTCB
+// {
+// 	HTREEITEM hParent;
+// 	PFNTVCOMPARE lpfnCompare;
+// 	LPARAM lParam;
+// }
+//
+// alias TV_SORTCB* LPTV_SORTCB;
+// alias TV_SORTCB _TV_SORTCB;
+// alias TV_SORTCB TTVSORTCB;
+// alias TV_SORTCB* PTVSORTCB;
 
 struct UDACCEL
 {