changeset 44:c913756e6950

Combo
author Frank Benoit <benoit@tionex.de>
date Sat, 02 Feb 2008 01:51:46 +0100
parents 9c2b9c930ceb
children f4a025bb42e9
files dwt/internal/C.d dwt/internal/win32/OS.d dwt/internal/win32/WINTYPES.d dwt/widgets/ColorDialog.d dwt/widgets/Combo.d
diffstat 5 files changed, 387 insertions(+), 364 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/internal/C.d	Fri Feb 01 22:31:06 2008 +0100
+++ b/dwt/internal/C.d	Sat Feb 02 01:51:46 2008 +0100
@@ -1,4 +1,4 @@
-/*******************************************************************************
+/*******************************************************************************
  * Copyright (c) 2000, 2007 IBM Corporation and others.
  * All rights reserved. This program and the accompanying materials
  * are made available under the terms of the Eclipse Public License v1.0
@@ -12,8 +12,10 @@
 
 import dwt.internal.Platform;
 
+static import tango.stdc.string;
+
 public class C : Platform {
-
+    alias tango.stdc.string.memmove MoveMemory;
 //public static final native void free (int /*long*/ ptr);
 //public static final native int /*long*/ getenv (byte[] wcsToMbcs);
 //public static final native int /*long*/ malloc (int /*long*/ size);
--- a/dwt/internal/win32/OS.d	Fri Feb 01 22:31:06 2008 +0100
+++ b/dwt/internal/win32/OS.d	Sat Feb 02 01:51:46 2008 +0100
@@ -3846,7 +3846,7 @@
 // Unicode/Ansi alias
 version(ANSI) {
     alias WINAPI.AddFontResourceExA AddFontResourceEx;
-    alias WINAPI.CallWindowProcA CallWindowProc;
+    alias STDWIN.CallWindowProcA CallWindowProc;
     alias WINAPI.CharLowerA CharLower;
     alias WINAPI.CharUpperA CharUpper;
     alias WINAPI.ChooseColorA ChooseColor;
@@ -3944,7 +3944,7 @@
     alias WINAPI.VkKeyScanA VkKeyScan;
 }else{
     alias WINAPI.AddFontResourceExW AddFontResourceEx;
-    alias WINAPI.CallWindowProcW CallWindowProc;
+    alias STDWIN.CallWindowProcW CallWindowProc;
     alias WINAPI.CharLowerW CharLower;
     alias WINAPI.CharUpperW CharUpper;
     alias WINAPI.ChooseColorW ChooseColor;
--- a/dwt/internal/win32/WINTYPES.d	Fri Feb 01 22:31:06 2008 +0100
+++ b/dwt/internal/win32/WINTYPES.d	Sat Feb 02 01:51:46 2008 +0100
@@ -89,7 +89,7 @@
  * something else. This made some DWT API failed. to fix the problem, it better to declare (msg, wparam)
  * as int like Eclispe/SWT does. and we alias int to WPARAM_I.
  */
-alias LRESULT function(HWND, int, int, int) WNDPROC_I;
+alias LRESULT function(HWND, uint, uint, int) WNDPROC_I;
 alias LRESULT function(int code, int wParam, LPARAM lParam) HOOKPROC_I;
 
 // Windows CALLBACK declaration here
--- a/dwt/widgets/ColorDialog.d	Fri Feb 01 22:31:06 2008 +0100
+++ b/dwt/widgets/ColorDialog.d	Sat Feb 02 01:51:46 2008 +0100
@@ -100,12 +100,12 @@
     checkSubclass ();
 }
 
-private static extern(Windows) int CCHookFunc (HWND hdlg, int uiMsg, int lParam, int lpData) {
+private static extern(Windows) int CCHookFunc (HWND hdlg, uint uiMsg, uint lParam, int lpData) {
     ColorDialog dlg = cast(ColorDialog)cast(void*)lpData;
     return dlg.CCHookProc( hdlg, uiMsg, lParam );
 }
 
-int CCHookProc (HWND hdlg, int uiMsg, int lParam ) {
+int CCHookProc (HWND hdlg, uint uiMsg, uint lParam ) {
     switch (uiMsg) {
         case OS.WM_INITDIALOG: {
             RECT rect;
--- a/dwt/widgets/Combo.d	Fri Feb 01 22:31:06 2008 +0100
+++ b/dwt/widgets/Combo.d	Sat Feb 02 01:51:46 2008 +0100
@@ -14,9 +14,6 @@
 
 import dwt.widgets.Composite;
 
-class Combo : Composite {
-}
-/++
 import dwt.DWT;
 import dwt.DWTException;
 import dwt.events.ModifyListener;
@@ -25,15 +22,15 @@
 import dwt.events.VerifyListener;
 import dwt.graphics.Font;
 import dwt.graphics.Point;
-import dwt.internal.Callback;
-import dwt.internal.win32.COMBOBOXINFO;
-import dwt.internal.win32.LRESULT;
-import dwt.internal.win32.MONITORINFO;
-import dwt.internal.win32.MSG;
 import dwt.internal.win32.OS;
-import dwt.internal.win32.RECT;
-import dwt.internal.win32.TCHAR;
-import dwt.internal.win32.WNDCLASS;
+
+import dwt.widgets.TypedListener;
+import dwt.widgets.Event;
+import dwt.widgets.Composite;
+import dwt.widgets.Shell;
+import dwt.widgets.Display;
+
+import dwt.dwthelper.utils;
 
 /**
  * Instances of this class are controls that allow the user
@@ -71,43 +68,55 @@
  * @see List
  */
 
-public class Combo extends Composite {
+public class Combo : Composite {
+
+    alias Composite.sendKeyEvent sendKeyEvent;
+
+    alias extern(Windows) int function( HWND, uint, uint, int ) TWindowProc;
+    private static Combo pThis;
     bool noSelection, ignoreDefaultSelection, ignoreCharacter, ignoreModify;
-    int cbtHook, scrollWidth, visibleCount = 5;
+    HHOOK cbtHook;
+    int scrollWidth, visibleCount = 5;
 
     /**
      * the operating system limit for the number of characters
      * that the text field in an instance of this class can hold
      */
-    public static final int LIMIT;
+    private static int LIMIT_ = 0;
 
     /*
      * These values can be different on different platforms.
      * Therefore they are not initialized in the declaration
      * to stop the compiler from inlining.
      */
-    static {
-        LIMIT = OS.IsWinNT ? 0x7FFFFFFF : 0x7FFF;
+    public static int LIMIT(){
+        if( LIMIT_ is 0 ){
+            synchronized {
+                LIMIT_ = OS.IsWinNT ? 0x7FFFFFFF : 0x7FFF;
+            }
+        }
+        return LIMIT_;
     }
-
     /*
      * These are the undocumented control id's for the children of
      * a combo box.  Since there are no constants for these values,
      * they may change with different versions of Windows (but have
      * been the same since Windows 3.0).
      */
-    static final int CBID_LIST = 1000;
-    static final int CBID_EDIT = 1001;
-    static /*final*/ int EditProc, ListProc;
+    static const int CBID_LIST = 1000;
+    static const int CBID_EDIT = 1001;
+    static /*final*/ TWindowProc EditProc, ListProc;
 
-    static final int ComboProc;
-    static final TCHAR ComboClass = new TCHAR (0, "COMBOBOX", true);
-    static {
-        WNDCLASS lpWndClass = new WNDCLASS ();
-        OS.GetClassInfo (0, ComboClass, lpWndClass);
+    static const TWindowProc ComboProc;
+    static const TCHAR* ComboClass = "COMBOBOX\0";
+
+    static this() {
+        WNDCLASS lpWndClass;
+        OS.GetClassInfo (null, ComboClass, &lpWndClass);
         ComboProc = lpWndClass.lpfnWndProc;
     }
 
+
 /**
  * Constructs a new instance of this class given its parent
  * and a style value describing its behavior and appearance.
@@ -138,7 +147,7 @@
  * @see Widget#checkSubclass
  * @see Widget#getStyle
  */
-public Combo (Composite parent, int style) {
+public this (Composite parent, int style) {
     super (parent, checkStyle (style));
     /* This code is intentionally commented */
     //if ((style & DWT.H_SCROLL) !is 0) this.style |= DWT.H_SCROLL;
@@ -160,11 +169,11 @@
  *
  * @see #add(String,int)
  */
-public void add (String string) {
+public void add (char[] string) {
     checkWidget ();
     if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
-    TCHAR buffer = new TCHAR (getCodePage (), string, true);
-    int result = OS.SendMessage (handle, OS.CB_ADDSTRING, 0, buffer);
+    auto buffer = StrToTCHARs( string );
+    int result = OS.SendMessage (handle, OS.CB_ADDSTRING, 0, buffer.ptr );
     if (result is OS.CB_ERR) error (DWT.ERROR_ITEM_NOT_ADDED);
     if (result is OS.CB_ERRSPACE) error (DWT.ERROR_ITEM_NOT_ADDED);
     if ((style & DWT.H_SCROLL) !is 0) setScrollWidth (buffer, true);
@@ -193,15 +202,15 @@
  *
  * @see #add(String)
  */
-public void add (String string, int index) {
+public void add (char[] string, int index) {
     checkWidget ();
     if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
     int count = OS.SendMessage (handle, OS.CB_GETCOUNT, 0, 0);
     if (!(0 <= index && index <= count)) {
         error (DWT.ERROR_INVALID_RANGE);
     }
-    TCHAR buffer = new TCHAR (getCodePage (), string, true);
-    int result = OS.SendMessage (handle, OS.CB_INSERTSTRING, index, buffer);
+    auto buffer = StrToTCHARs( string );
+    int result = OS.SendMessage (handle, OS.CB_INSERTSTRING, index, buffer.ptr);
     if (result is OS.CB_ERRSPACE || result is OS.CB_ERR) {
         error (DWT.ERROR_ITEM_NOT_ADDED);
     }
@@ -294,36 +303,40 @@
     addListener (DWT.Verify, typedListener);
 }
 
-int callWindowProc (int hwnd, int msg, int wParam, int lParam) {
-    if (handle is 0) return 0;
+override LRESULT callWindowProc (HWND hwnd, int msg, int wParam, int lParam) {
+    if (handle is null) return LRESULT.ZERO;
     if (hwnd is handle) {
-        return OS.CallWindowProc (ComboProc, hwnd, msg, wParam, lParam);
+        return cast(LRESULT) OS.CallWindowProc( ComboProc, hwnd, msg, wParam, lParam);
     }
-    int hwndText = OS.GetDlgItem (handle, CBID_EDIT);
+    auto hwndText = OS.GetDlgItem (handle, CBID_EDIT);
     if (hwnd is hwndText) {
-        return OS.CallWindowProc (EditProc, hwnd, msg, wParam, lParam);
+        return cast(LRESULT) OS.CallWindowProc( EditProc, hwnd, msg, wParam, lParam);
     }
-    int hwndList = OS.GetDlgItem (handle, CBID_LIST);
+    auto hwndList = OS.GetDlgItem (handle, CBID_LIST);
     if (hwnd is hwndList) {
-        return OS.CallWindowProc (ListProc, hwnd, msg, wParam, lParam);
+        return cast(LRESULT) OS.CallWindowProc( ListProc, hwnd, msg, wParam, lParam);
     }
-    return OS.DefWindowProc (hwnd, msg, wParam, lParam);
+    return cast(LRESULT) OS.DefWindowProc (hwnd, msg, wParam, lParam);
+}
+
+private static extern(Windows) int CBTFunc (int nCode, int wParam, int lParam) {
+    return pThis.CBTProc( nCode, wParam, lParam );
 }
 
 int CBTProc (int nCode, int wParam, int lParam) {
     if (nCode is OS.HCBT_CREATEWND) {
-        TCHAR buffer = new TCHAR (0, 128);
-        OS.GetClassName (wParam, buffer, buffer.length ());
-        String className = buffer.toString (0, buffer.strlen ());
-        if (className.equals ("Edit") || className.equals ("EDIT")) { //$NON-NLS-1$  //$NON-NLS-2$
-            int bits = OS.GetWindowLong (wParam, OS.GWL_STYLE);
-            OS.SetWindowLong (wParam, OS.GWL_STYLE, bits & ~OS.ES_NOHIDESEL);
+        TCHAR[128] buffer = 0;
+        OS.GetClassName (cast(HANDLE)wParam, buffer.ptr, buffer.length );
+        char[] className = TCHARzToStr(buffer.ptr);
+        if (className=="Edit" || className=="EDIT") { //$NON-NLS-1$  //$NON-NLS-2$
+            int bits = OS.GetWindowLong (cast(HANDLE)wParam, OS.GWL_STYLE);
+            OS.SetWindowLong (cast(HANDLE)wParam, OS.GWL_STYLE, bits & ~OS.ES_NOHIDESEL);
         }
     }
     return OS.CallNextHookEx (cbtHook, nCode, wParam, lParam);
 }
 
-bool checkHandle (int hwnd) {
+bool checkHandle (HWND hwnd) {
     return hwnd is handle || hwnd is OS.GetDlgItem (handle, CBID_EDIT) || hwnd is OS.GetDlgItem (handle, CBID_LIST);
 }
 
@@ -385,36 +398,37 @@
     checkWidget ();
     int width = 0, height = 0;
     if (wHint is DWT.DEFAULT) {
-        int newFont, oldFont = 0;
-        int hDC = OS.GetDC (handle);
-        newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
-        if (newFont !is 0) oldFont = OS.SelectObject (hDC, newFont);
+        HFONT newFont, oldFont;
+        auto hDC = OS.GetDC (handle);
+        newFont = cast(HFONT) OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
+        if (newFont !is null) oldFont = OS.SelectObject (hDC, newFont);
         int count = OS.SendMessage (handle, OS.CB_GETCOUNT, 0, 0);
-        RECT rect = new RECT ();
+        RECT rect;
         int flags = OS.DT_CALCRECT | OS.DT_NOPREFIX;
         if ((style & DWT.READ_ONLY) is 0) flags |= OS.DT_EDITCONTROL;
-        int length = OS.GetWindowTextLength (handle);
+        int length_ = OS.GetWindowTextLength (handle);
         int cp = getCodePage ();
-        TCHAR buffer = new TCHAR (cp, length + 1);
-        OS.GetWindowText (handle, buffer, length + 1);
-        OS.DrawText (hDC, buffer, length, rect, flags);
+        TCHAR[] buffer = new TCHAR[ length_ + 1];
+        buffer[] = 0;
+        OS.GetWindowText (handle, buffer.ptr, length_ + 1);
+        OS.DrawText (hDC, buffer.ptr, length_, &rect, flags);
         width = Math.max (width, rect.right - rect.left);
         if ((style & DWT.H_SCROLL) !is 0) {
             width = Math.max (width, scrollWidth);
         } else {
             for (int i=0; i<count; i++) {
-                length = OS.SendMessage (handle, OS.CB_GETLBTEXTLEN, i, 0);
-                if (length !is OS.CB_ERR) {
-                    if (length + 1 > buffer.length ()) buffer = new TCHAR (cp, length + 1);
-                    int result = OS.SendMessage (handle, OS.CB_GETLBTEXT, i, buffer);
+                length_ = OS.SendMessage (handle, OS.CB_GETLBTEXTLEN, i, 0);
+                if (length_ !is OS.CB_ERR) {
+                    if (length_ + 1 > buffer.length ) buffer = new TCHAR[ length_ + 1 ], buffer[] =0;
+                    int result = OS.SendMessage (handle, OS.CB_GETLBTEXT, i, buffer.ptr);
                     if (result !is OS.CB_ERR) {
-                        OS.DrawText (hDC, buffer, length, rect, flags);
+                        OS.DrawText (hDC, buffer.ptr, length_, &rect, flags);
                         width = Math.max (width, rect.right - rect.left);
                     }
                 }
             }
         }
-        if (newFont !is 0) OS.SelectObject (hDC, oldFont);
+        if (newFont !is null) OS.SelectObject (hDC, oldFont);
         OS.ReleaseDC (handle, hDC);
     }
     if (hHint is DWT.DEFAULT) {
@@ -431,18 +445,18 @@
     if ((style & DWT.READ_ONLY) !is 0) {
         width += 8;
     } else {
-        int hwndText = OS.GetDlgItem (handle, CBID_EDIT);
-        if (hwndText !is 0) {
+        auto hwndText = OS.GetDlgItem (handle, CBID_EDIT);
+        if (hwndText !is null) {
             int margins = OS.SendMessage (hwndText, OS.EM_GETMARGINS, 0, 0);
             int marginWidth = (margins & 0xFFFF) + ((margins >> 16) & 0xFFFF);
             width += marginWidth + 3;
         }
     }
-    COMBOBOXINFO pcbi = new COMBOBOXINFO ();
+    COMBOBOXINFO pcbi;
     pcbi.cbSize = COMBOBOXINFO.sizeof;
-    if (((style & DWT.SIMPLE) is 0) && !OS.IsWinCE && OS.GetComboBoxInfo (handle, pcbi)) {
-        width += pcbi.itemLeft + (pcbi.buttonRight - pcbi.buttonLeft);
-        height = (pcbi.buttonBottom - pcbi.buttonTop) + pcbi.buttonTop * 2;
+    if (((style & DWT.SIMPLE) is 0) && !OS.IsWinCE && OS.GetComboBoxInfo (handle, &pcbi)) {
+        width += pcbi.rcItem.left + (pcbi.rcButton.right - pcbi.rcButton.left);
+        height = (pcbi.rcButton.bottom - pcbi.rcButton.top) + pcbi.rcButton.top * 2;
     } else {
         int border = OS.GetSystemMetrics (OS.SM_CXEDGE);
         width += OS.GetSystemMetrics (OS.SM_CXVSCROLL) + border * 2;
@@ -492,25 +506,27 @@
         super.createHandle ();
     } else {
         int threadId = OS.GetCurrentThreadId ();
-        Callback cbtCallback = new Callback (this, "CBTProc", 3); //$NON-NLS-1$
-        int cbtProc = cbtCallback.getAddress ();
-        if (cbtProc is 0) error (DWT.ERROR_NO_MORE_CALLBACKS);
-        cbtHook = OS.SetWindowsHookEx (OS.WH_CBT, cbtProc, 0, threadId);
+        //Callback cbtCallback = new Callback (this, "CBTProc", 3); //$NON-NLS-1$
+        //int cbtProc = cbtCallback.getAddress ();
+        //if (cbtProc is 0) error (DWT.ERROR_NO_MORE_CALLBACKS);
+        pThis = this;
+        cbtHook = OS.SetWindowsHookEx (OS.WH_CBT, &CBTFunc, null, threadId);
         super.createHandle ();
-        if (cbtHook !is 0) OS.UnhookWindowsHookEx (cbtHook);
-        cbtHook = 0;
-        cbtCallback.dispose ();
+        if (cbtHook !is null) OS.UnhookWindowsHookEx (cbtHook);
+        pThis = null;
+        //cbtHook = 0;
+        //cbtCallback.dispose ();
     }
     state &= ~(CANVAS | THEME_BACKGROUND);
 
     /* Get the text and list window procs */
-    int hwndText = OS.GetDlgItem (handle, CBID_EDIT);
-    if (hwndText !is 0 && EditProc is 0) {
-        EditProc = OS.GetWindowLong (hwndText, OS.GWL_WNDPROC);
+    auto hwndText = OS.GetDlgItem (handle, CBID_EDIT);
+    if (hwndText !is null && EditProc is null) {
+        EditProc = cast(TWindowProc) OS.GetWindowLong (hwndText, OS.GWL_WNDPROC);
     }
-    int hwndList = OS.GetDlgItem (handle, CBID_LIST);
-    if (hwndList !is 0 && ListProc is 0) {
-        ListProc = OS.GetWindowLong (hwndList, OS.GWL_WNDPROC);
+    auto hwndList = OS.GetDlgItem (handle, CBID_LIST);
+    if (hwndList !is null && ListProc is null) {
+        ListProc = cast(TWindowProc) OS.GetWindowLong (hwndList, OS.GWL_WNDPROC);
     }
 
     /*
@@ -521,8 +537,8 @@
     */
     if ((style & DWT.SIMPLE) !is 0) {
         int flags = OS.SWP_NOZORDER | OS.SWP_DRAWFRAME | OS.SWP_NOACTIVATE;
-        SetWindowPos (handle, 0, 0, 0, 0x3FFF, 0x3FFF, flags);
-        SetWindowPos (handle, 0, 0, 0, 0, 0, flags);
+        SetWindowPos (handle, null, 0, 0, 0x3FFF, 0x3FFF, flags);
+        SetWindowPos (handle, null, 0, 0, 0, 0, flags);
     }
 }
 
@@ -552,10 +568,10 @@
 
 void deregister () {
     super.deregister ();
-    int hwndText = OS.GetDlgItem (handle, CBID_EDIT);
-    if (hwndText !is 0) display.removeControl (hwndText);
-    int hwndList = OS.GetDlgItem (handle, CBID_LIST);
-    if (hwndList !is 0) display.removeControl (hwndList);
+    auto hwndText = OS.GetDlgItem (handle, CBID_EDIT);
+    if (hwndText !is null) display.removeControl (hwndText);
+    auto hwndList = OS.GetDlgItem (handle, CBID_LIST);
+    if (hwndList !is null) display.removeControl (hwndList);
 }
 
 /**
@@ -600,16 +616,16 @@
     // widget could be disposed at this point
 }
 
-bool dragDetect (int hwnd, int x, int y, bool filter, bool [] detect, bool [] consume) {
+bool dragDetect (HWND hwnd, int x, int y, bool filter, bool [] detect, bool [] consume) {
     if (filter && (style & DWT.READ_ONLY) is 0) {
-        int hwndText = OS.GetDlgItem (handle, CBID_EDIT);
-        if (hwndText !is 0) {
-            int [] start = new int [1], end = new int [1];
-            OS.SendMessage (handle, OS.CB_GETEDITSEL, start, end);
-            if (start [0] !is end [0]) {
+        auto hwndText = OS.GetDlgItem (handle, CBID_EDIT);
+        if (hwndText !is null) {
+            int start, end;
+            OS.SendMessage (handle, OS.CB_GETEDITSEL, &start, &end);
+            if (start !is end ) {
                 int lParam = (x & 0xFFFF) | ((y << 16) & 0xFFFF0000);
                 int position = OS.SendMessage (hwndText, OS.EM_CHARFROMPOS, 0, lParam) & 0xFFFF;
-                if (start [0] <= position && position < end [0]) {
+                if (start <= position && position < end ) {
                     if (super.dragDetect (hwnd, x, y, filter, detect, consume)) {
                         if (consume !is null) consume [0] = true;
                         return true;
@@ -638,13 +654,13 @@
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
  */
-public String getItem (int index) {
+public char[] getItem (int index) {
     checkWidget ();
-    int length = OS.SendMessage (handle, OS.CB_GETLBTEXTLEN, index, 0);
-    if (length !is OS.CB_ERR) {
-        TCHAR buffer = new TCHAR (getCodePage (), length + 1);
-        int result = OS.SendMessage (handle, OS.CB_GETLBTEXT, index, buffer);
-        if (result !is OS.CB_ERR) return buffer.toString (0, length);
+    int length_ = OS.SendMessage (handle, OS.CB_GETLBTEXTLEN, index, 0);
+    if (length_ !is OS.CB_ERR) {
+        TCHAR[] buffer = new TCHAR[ length_ + 1];
+        int result = OS.SendMessage (handle, OS.CB_GETLBTEXT, index, buffer.ptr);
+        if (result !is OS.CB_ERR) return TCHARzToStr( buffer.ptr );
     }
     int count = OS.SendMessage (handle, OS.CB_GETCOUNT, 0, 0);
     if (0 <= index && index < count) error (DWT.ERROR_CANNOT_GET_ITEM);
@@ -703,10 +719,10 @@
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
  */
-public String [] getItems () {
+public char[] [] getItems () {
     checkWidget ();
     int count = getItemCount ();
-    String [] result = new String [count];
+    char[] [] result = new char[] [count];
     for (int i=0; i<count; i++) result [i] = getItem (i);
     return result;
 }
@@ -738,7 +754,7 @@
     return true;
 }
 
-String getNameText () {
+char[] getNameText () {
     return getText ();
 }
 
@@ -783,13 +799,13 @@
     if ((style & DWT.DROP_DOWN) !is 0 && (style & DWT.READ_ONLY) !is 0) {
         return new Point (0, OS.GetWindowTextLength (handle));
     }
-    int [] start = new int [1], end = new int [1];
-    OS.SendMessage (handle, OS.CB_GETEDITSEL, start, end);
+    int start, end;
+    OS.SendMessage (handle, OS.CB_GETEDITSEL, &start, &end);
     if (!OS.IsUnicode && OS.IsDBLocale) {
-        start [0] = mbcsToWcsPos (start [0]);
-        end [0] = mbcsToWcsPos (end [0]);
+        start = mbcsToWcsPos (start);
+        end = mbcsToWcsPos (end);
     }
-    return new Point (start [0], end [0]);
+    return new Point (start, end);
 }
 
 /**
@@ -821,13 +837,13 @@
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
  */
-public String getText () {
+public char[] getText () {
     checkWidget ();
-    int length = OS.GetWindowTextLength (handle);
-    if (length is 0) return "";
-    TCHAR buffer = new TCHAR (getCodePage (), length + 1);
-    OS.GetWindowText (handle, buffer, length + 1);
-    return buffer.toString (0, length);
+    int length_ = OS.GetWindowTextLength (handle);
+    if (length_ is 0) return "";
+    TCHAR[] buffer = new TCHAR[ length_ + 1];
+    OS.GetWindowText (handle, buffer.ptr, length_ + 1);
+    return TCHARzToStr( buffer.ptr );
 }
 
 /**
@@ -842,10 +858,10 @@
  */
 public int getTextHeight () {
     checkWidget ();
-    COMBOBOXINFO pcbi = new COMBOBOXINFO ();
+    COMBOBOXINFO pcbi;
     pcbi.cbSize = COMBOBOXINFO.sizeof;
-    if (((style & DWT.SIMPLE) is 0) && !OS.IsWinCE && OS.GetComboBoxInfo (handle, pcbi)) {
-        return (pcbi.buttonBottom - pcbi.buttonTop) + pcbi.buttonTop * 2;
+    if (((style & DWT.SIMPLE) is 0) && !OS.IsWinCE && OS.GetComboBoxInfo (handle, &pcbi)) {
+        return (pcbi.rcButton.bottom - pcbi.rcButton.top) + pcbi.rcButton.top * 2;
     }
     int result = OS.SendMessage (handle, OS.CB_GETITEMHEIGHT, -1, 0);
     if (result is OS.CB_ERR) error (DWT.ERROR_CANNOT_GET_ITEM_HEIGHT);
@@ -869,8 +885,8 @@
  */
 public int getTextLimit () {
     checkWidget ();
-    int hwndText = OS.GetDlgItem (handle, CBID_EDIT);
-    if (hwndText is 0) return LIMIT;
+    auto hwndText = OS.GetDlgItem (handle, CBID_EDIT);
+    if (hwndText is null) return LIMIT;
     return OS.SendMessage (hwndText, OS.EM_GETLIMITTEXT, 0, 0) & 0x7FFFFFFF;
 }
 
@@ -897,12 +913,12 @@
 }
 
 bool hasFocus () {
-    int hwndFocus = OS.GetFocus ();
+    auto hwndFocus = OS.GetFocus ();
     if (hwndFocus is handle) return true;
-    if (hwndFocus is 0) return false;
-    int hwndText = OS.GetDlgItem (handle, CBID_EDIT);
+    if (hwndFocus is null) return false;
+    auto hwndText = OS.GetDlgItem (handle, CBID_EDIT);
     if (hwndFocus is hwndText) return true;
-    int hwndList = OS.GetDlgItem (handle, CBID_LIST);
+    auto hwndList = OS.GetDlgItem (handle, CBID_LIST);
     if (hwndFocus is hwndList) return true;
     return false;
 }
@@ -924,7 +940,7 @@
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
  */
-public int indexOf (String string) {
+public int indexOf (char[] string) {
     return indexOf (string, 0);
 }
 
@@ -947,7 +963,7 @@
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
  */
-public int indexOf (String string, int start) {
+public int indexOf (char[] string, int start) {
     checkWidget ();
     if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
 
@@ -957,10 +973,10 @@
     * to insert an empty string into a combo.  The fix is
     * to search the combo, an item at a time.
     */
-    if (string.length () is 0) {
+    if (string.length  is 0) {
         int count = getItemCount ();
         for (int i=start; i<count; i++) {
-            if (string.equals (getItem (i))) return i;
+            if (string==/*eq*/getItem (i)) return i;
         }
         return -1;
     }
@@ -969,25 +985,26 @@
     int count = OS.SendMessage (handle, OS.CB_GETCOUNT, 0, 0);
     if (!(0 <= start && start < count)) return -1;
     int index = start - 1, last = 0;
-    TCHAR buffer = new TCHAR (getCodePage (), string, true);
+    TCHAR* buffer = StrToTCHARz( string );
     do {
         index = OS.SendMessage (handle, OS.CB_FINDSTRINGEXACT, last = index, buffer);
         if (index is OS.CB_ERR || index <= last) return -1;
-    } while (!string.equals (getItem (index)));
+    } while (string!=/*eq*/getItem (index));
     return index;
 }
 
 int mbcsToWcsPos (int mbcsPos) {
     if (mbcsPos <= 0) return 0;
     if (OS.IsUnicode) return mbcsPos;
-    int hwndText = OS.GetDlgItem (handle, CBID_EDIT);
-    if (hwndText is 0) return mbcsPos;
+    auto hwndText = OS.GetDlgItem (handle, CBID_EDIT);
+    if (hwndText is null) return mbcsPos;
     int mbcsSize = OS.GetWindowTextLengthA (hwndText);
     if (mbcsSize is 0) return 0;
     if (mbcsPos >= mbcsSize) return mbcsSize;
-    byte [] buffer = new byte [mbcsSize + 1];
-    OS.GetWindowTextA (hwndText, buffer, mbcsSize + 1);
-    return OS.MultiByteToWideChar (getCodePage (), OS.MB_PRECOMPOSED, buffer, mbcsPos, null, 0);
+    char [] buffer = new char [mbcsSize + 1];
+    buffer[] = 0;
+    OS.GetWindowTextA (hwndText, buffer.ptr, mbcsSize + 1);
+    return OS.MultiByteToWideChar (getCodePage (), OS.MB_PRECOMPOSED, buffer.ptr, mbcsPos, null, 0);
 }
 
 /**
@@ -1012,10 +1029,10 @@
 
 void register () {
     super.register ();
-    int hwndText = OS.GetDlgItem (handle, CBID_EDIT);
-    if (hwndText !is 0) display.addControl (hwndText, this);
-    int hwndList = OS.GetDlgItem (handle, CBID_LIST);
-    if (hwndList !is 0) display.addControl (hwndList, this);
+    auto hwndText = OS.GetDlgItem (handle, CBID_EDIT);
+    if (hwndText !is null) display.addControl (hwndText, this);
+    auto hwndList = OS.GetDlgItem (handle, CBID_LIST);
+    if (hwndList !is null) display.addControl (hwndList, this);
 }
 
 /**
@@ -1038,23 +1055,23 @@
 }
 
 void remove (int index, bool notify) {
-    TCHAR buffer = null;
+    TCHAR[] buffer = null;
     if ((style & DWT.H_SCROLL) !is 0) {
-        int length = OS.SendMessage (handle, OS.CB_GETLBTEXTLEN, index, 0);
-        if (length is OS.CB_ERR) {
+        int length_ = OS.SendMessage (handle, OS.CB_GETLBTEXTLEN, index, 0);
+        if (length_ is OS.CB_ERR) {
             int count = OS.SendMessage (handle, OS.CB_GETCOUNT, 0, 0);
             if (0 <= index && index < count) error (DWT.ERROR_ITEM_NOT_REMOVED);
             error (DWT.ERROR_INVALID_RANGE);
         }
-        buffer = new TCHAR (getCodePage (), length + 1);
-        int result = OS.SendMessage (handle, OS.CB_GETLBTEXT, index, buffer);
+        buffer = new TCHAR[ length_ + 1];
+        int result = OS.SendMessage (handle, OS.CB_GETLBTEXT, index, buffer.ptr);
         if (result is OS.CB_ERR) {
             int count = OS.SendMessage (handle, OS.CB_GETCOUNT, 0, 0);
             if (0 <= index && index < count) error (DWT.ERROR_ITEM_NOT_REMOVED);
             error (DWT.ERROR_INVALID_RANGE);
         }
     }
-    int length = OS.GetWindowTextLength (handle);
+    int length_ = OS.GetWindowTextLength (handle);
     int code = OS.SendMessage (handle, OS.CB_DELETESTRING, index, 0);
     if (code is OS.CB_ERR) {
         int count = OS.SendMessage (handle, OS.CB_GETCOUNT, 0, 0);
@@ -1062,7 +1079,7 @@
         error (DWT.ERROR_INVALID_RANGE);
     }
     if ((style & DWT.H_SCROLL) !is 0) setScrollWidth (buffer, true);
-    if (notify && length !is OS.GetWindowTextLength (handle)) {
+    if (notify && length_ !is OS.GetWindowTextLength (handle)) {
         sendEvent (DWT.Modify);
         if (isDisposed ()) return;
     }
@@ -1103,34 +1120,36 @@
         error (DWT.ERROR_INVALID_RANGE);
     }
     int textLength = OS.GetWindowTextLength (handle);
-    RECT rect = null;
-    int hDC = 0, oldFont = 0, newFont = 0, newWidth = 0;
+    RECT rect;
+    HDC hDC;
+    HFONT oldFont, newFont;
+    int newWidth = 0;
     if ((style & DWT.H_SCROLL) !is 0) {
-        rect = new RECT ();
+        //rect = new RECT ();
         hDC = OS.GetDC (handle);
-        newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
-        if (newFont !is 0) oldFont = OS.SelectObject (hDC, newFont);
+        newFont = cast(HFONT) OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
+        if (newFont !is null) oldFont = OS.SelectObject (hDC, newFont);
     }
     int cp = getCodePage ();
     int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE | OS.DT_NOPREFIX;
     for (int i=start; i<=end; i++) {
-        TCHAR buffer = null;
+        TCHAR[] buffer = null;
         if ((style & DWT.H_SCROLL) !is 0) {
-            int length = OS.SendMessage (handle, OS.CB_GETLBTEXTLEN, start, 0);
-            if (length is OS.CB_ERR) break;
-            buffer = new TCHAR (cp, length + 1);
-            int result = OS.SendMessage (handle, OS.CB_GETLBTEXT, start, buffer);
+            int length_ = OS.SendMessage (handle, OS.CB_GETLBTEXTLEN, start, 0);
+            if (length_ is OS.CB_ERR) break;
+            buffer = new TCHAR[ length_ + 1];
+            int result = OS.SendMessage (handle, OS.CB_GETLBTEXT, start, buffer.ptr);
             if (result is OS.CB_ERR) break;
         }
         int result = OS.SendMessage (handle, OS.CB_DELETESTRING, start, 0);
         if (result is OS.CB_ERR) error (DWT.ERROR_ITEM_NOT_REMOVED);
         if ((style & DWT.H_SCROLL) !is 0) {
-            OS.DrawText (hDC, buffer, -1, rect, flags);
+            OS.DrawText (hDC, buffer.ptr, -1, &rect, flags);
             newWidth = Math.max (newWidth, rect.right - rect.left);
         }
     }
     if ((style & DWT.H_SCROLL) !is 0) {
-        if (newFont !is 0) OS.SelectObject (hDC, oldFont);
+        if (newFont !is null) OS.SelectObject (hDC, oldFont);
         OS.ReleaseDC (handle, hDC);
         setScrollWidth (newWidth, false);
     }
@@ -1167,7 +1186,7 @@
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
  */
-public void remove (String string) {
+public void remove (char[] string) {
     checkWidget ();
     if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
     int index = indexOf (string, 0);
@@ -1303,51 +1322,51 @@
     }
 
     /* Verify the character */
-    String oldText = "";
-    int [] start = new int [1], end = new int [1];
-    int hwndText = OS.GetDlgItem (handle, CBID_EDIT);
-    if (hwndText is 0) return true;
+    char[] oldText = "";
+    int start, end;
+    auto hwndText = OS.GetDlgItem (handle, CBID_EDIT);
+    if (hwndText is null) return true;
     OS.SendMessage (hwndText, OS.EM_GETSEL, start, end);
     switch (key) {
         case 0x08:  /* Bs */
-            if (start [0] is end [0]) {
-                if (start [0] is 0) return true;
-                start [0] = start [0] - 1;
+            if (start  is end ) {
+                if (start  is 0) return true;
+                start  = start  - 1;
                 if (!OS.IsUnicode && OS.IsDBLocale) {
-                    int [] newStart = new int [1], newEnd = new int [1];
-                    OS.SendMessage (hwndText, OS.EM_SETSEL, start [0], end [0]);
+                    int newStart, newEnd;
+                    OS.SendMessage (hwndText, OS.EM_SETSEL, start , end );
                     OS.SendMessage (hwndText, OS.EM_GETSEL, newStart, newEnd);
-                    if (start [0] !is newStart [0]) start [0] = start [0] - 1;
+                    if (start  !is newStart ) start  = start  - 1;
                 }
-                start [0] = Math.max (start [0], 0);
+                start  = Math.max (start , 0);
             }
             break;
         case 0x7F:  /* Del */
-            if (start [0] is end [0]) {
-                int length = OS.GetWindowTextLength (hwndText);
-                if (start [0] is length) return true;
-                end [0] = end [0] + 1;
+            if (start  is end ) {
+                int length_ = OS.GetWindowTextLength (hwndText);
+                if (start  is length_) return true;
+                end  = end  + 1;
                 if (!OS.IsUnicode && OS.IsDBLocale) {
-                    int [] newStart = new int [1], newEnd = new int [1];
-                    OS.SendMessage (hwndText, OS.EM_SETSEL, start [0], end [0]);
+                    int newStart, newEnd;
+                    OS.SendMessage (hwndText, OS.EM_SETSEL, start , end );
                     OS.SendMessage (hwndText, OS.EM_GETSEL, newStart, newEnd);
-                    if (end [0] !is newEnd [0]) end [0] = end [0] + 1;
+                    if (end  !is newEnd ) end  = end  + 1;
                 }
-                end [0] = Math.min (end [0], length);
+                end  = Math.min (end , length_);
             }
             break;
         case '\r':  /* Return */
             return true;
         default:    /* Tab and other characters */
             if (key !is '\t' && key < 0x20) return true;
-            oldText = new String (new char [] {key});
+            oldText = [key];
             break;
     }
-    String newText = verifyText (oldText, start [0], end [0], event);
+    char[] newText = verifyText (oldText, start, end, event);
     if (newText is null) return false;
     if (newText is oldText) return true;
-    TCHAR buffer = new TCHAR (getCodePage (), newText, true);
-    OS.SendMessage (hwndText, OS.EM_SETSEL, start [0], end [0]);
+    TCHAR* buffer = StrToTCHARz( newText );
+    OS.SendMessage (hwndText, OS.EM_SETSEL, start, end);
     OS.SendMessage (hwndText, OS.EM_REPLACESEL, 0, buffer);
     return false;
 }
@@ -1377,20 +1396,20 @@
     }
 }
 
-void setBackgroundImage (int hBitmap) {
+void setBackgroundImage (HBITMAP hBitmap) {
     super.setBackgroundImage (hBitmap);
-    int hwndText = OS.GetDlgItem (handle, CBID_EDIT);
-    if (hwndText !is 0) OS.InvalidateRect (hwndText, null, true);
-    int hwndList = OS.GetDlgItem (handle, CBID_LIST);
-    if (hwndList !is 0) OS.InvalidateRect (hwndList, null, true);
+    auto hwndText = OS.GetDlgItem (handle, CBID_EDIT);
+    if (hwndText !is null) OS.InvalidateRect (hwndText, null, true);
+    auto hwndList = OS.GetDlgItem (handle, CBID_LIST);
+    if (hwndList !is null) OS.InvalidateRect (hwndList, null, true);
 }
 
 void setBackgroundPixel (int pixel) {
     super.setBackgroundPixel (pixel);
-    int hwndText = OS.GetDlgItem (handle, CBID_EDIT);
-    if (hwndText !is 0) OS.InvalidateRect (hwndText, null, true);
-    int hwndList = OS.GetDlgItem (handle, CBID_LIST);
-    if (hwndList !is 0) OS.InvalidateRect (hwndList, null, true);
+    auto hwndText = OS.GetDlgItem (handle, CBID_EDIT);
+    if (hwndText !is null) OS.InvalidateRect (hwndText, null, true);
+    auto hwndList = OS.GetDlgItem (handle, CBID_LIST);
+    if (hwndList !is null) OS.InvalidateRect (hwndList, null, true);
 }
 
 void setBounds (int x, int y, int width, int height, int flags) {
@@ -1426,15 +1445,15 @@
         * the width of the drop down control rect.  If the width of the
         * combo box is zero, then do not set SWP_NOSIZE.
         */
-        RECT rect = new RECT ();
-        OS.GetWindowRect (handle, rect);
+        RECT rect;
+        OS.GetWindowRect (handle, &rect);
         if (rect.right - rect.left !is 0) {
-            if (OS.SendMessage (handle, OS.CB_GETDROPPEDCONTROLRECT, 0, rect) !is 0) {
+            if (OS.SendMessage (handle, OS.CB_GETDROPPEDCONTROLRECT, 0, &rect) !is 0) {
                 int oldWidth = rect.right - rect.left, oldHeight = rect.bottom - rect.top;
                 if (oldWidth is width && oldHeight is height) flags |= OS.SWP_NOSIZE;
             }
         }
-        SetWindowPos (handle, 0, x, y, width, height, flags);
+        SetWindowPos (handle, null, x, y, width, height, flags);
     } else {
         super.setBounds (x, y, width, height, flags);
     }
@@ -1448,10 +1467,10 @@
 
 void setForegroundPixel (int pixel) {
     super.setForegroundPixel (pixel);
-    int hwndText = OS.GetDlgItem (handle, CBID_EDIT);
-    if (hwndText !is 0) OS.InvalidateRect (hwndText, null, true);
-    int hwndList = OS.GetDlgItem (handle, CBID_LIST);
-    if (hwndList !is 0) OS.InvalidateRect (hwndList, null, true);
+    auto hwndText = OS.GetDlgItem (handle, CBID_EDIT);
+    if (hwndText !is null) OS.InvalidateRect (hwndText, null, true);
+    auto hwndList = OS.GetDlgItem (handle, CBID_LIST);
+    if (hwndList !is null) OS.InvalidateRect (hwndList, null, true);
 }
 
 /**
@@ -1470,7 +1489,7 @@
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
  */
-public void setItem (int index, String string) {
+public void setItem (int index, char[] string) {
     checkWidget ();
     if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
     int selection = getSelectionIndex ();
@@ -1494,37 +1513,39 @@
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
  */
-public void setItems (String [] items) {
+public void setItems (char[] [] items) {
     checkWidget ();
     if (items is null) error (DWT.ERROR_NULL_ARGUMENT);
     for (int i=0; i<items.length; i++) {
         if (items [i] is null) error (DWT.ERROR_INVALID_ARGUMENT);
     }
-    RECT rect = null;
-    int hDC = 0, oldFont = 0, newFont = 0, newWidth = 0;
+    RECT rect;
+    HDC hDC;
+    HFONT oldFont, newFont;
+    int newWidth = 0;
     if ((style & DWT.H_SCROLL) !is 0) {
-        rect = new RECT ();
+        //rect = new RECT ();
         hDC = OS.GetDC (handle);
-        newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
-        if (newFont !is 0) oldFont = OS.SelectObject (hDC, newFont);
+        newFont = cast(HFONT) OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
+        if (newFont !is null) oldFont = OS.SelectObject (hDC, newFont);
         setScrollWidth (0);
     }
     OS.SendMessage (handle, OS.CB_RESETCONTENT, 0, 0);
     int codePage = getCodePage ();
     for (int i=0; i<items.length; i++) {
-        String string = items [i];
-        TCHAR buffer = new TCHAR (codePage, string, true);
+        char[] string = items [i];
+        TCHAR* buffer = StrToTCHARz( string );
         int code = OS.SendMessage (handle, OS.CB_ADDSTRING, 0, buffer);
         if (code is OS.CB_ERR) error (DWT.ERROR_ITEM_NOT_ADDED);
         if (code is OS.CB_ERRSPACE) error (DWT.ERROR_ITEM_NOT_ADDED);
         if ((style & DWT.H_SCROLL) !is 0) {
             int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE | OS.DT_NOPREFIX;
-            OS.DrawText (hDC, buffer, -1, rect, flags);
+            OS.DrawText (hDC, buffer, -1, &rect, flags);
             newWidth = Math.max (newWidth, rect.right - rect.left);
         }
     }
     if ((style & DWT.H_SCROLL) !is 0) {
-        if (newFont !is 0) OS.SelectObject (hDC, oldFont);
+        if (newFont !is null) OS.SelectObject (hDC, oldFont);
         OS.ReleaseDC (handle, hDC);
         setScrollWidth (newWidth + 3);
     }
@@ -1586,14 +1607,14 @@
         bits &= ~OS.WS_EX_LAYOUTRTL;
     }
     OS.SetWindowLong (handle, OS.GWL_EXSTYLE, bits);
-    int hwndText = 0, hwndList = 0;
-    COMBOBOXINFO pcbi = new COMBOBOXINFO ();
+    HWND hwndText, hwndList;
+    COMBOBOXINFO pcbi;
     pcbi.cbSize = COMBOBOXINFO.sizeof;
-    if (OS.GetComboBoxInfo (handle, pcbi)) {
+    if (OS.GetComboBoxInfo (handle, &pcbi)) {
         hwndText = pcbi.hwndItem;
         hwndList = pcbi.hwndList;
     }
-    if (hwndText !is 0) {
+    if (hwndText !is null) {
         int bits1 = OS.GetWindowLong (hwndText, OS.GWL_EXSTYLE);
         int bits2 = OS.GetWindowLong (hwndText, OS.GWL_STYLE);
         if ((style & DWT.RIGHT_TO_LEFT) !is 0) {
@@ -1612,19 +1633,19 @@
         * style bits.  The fix is to force the widget to be resized by
         * temporarily shrinking and then growing the width and height.
         */
-        RECT rect = new RECT ();
-        OS.GetWindowRect (hwndText, rect);
+        RECT rect;
+        OS.GetWindowRect (hwndText, &rect);
         int width = rect.right - rect.left, height = rect.bottom - rect.top;
-        OS.GetWindowRect (handle, rect);
+        OS.GetWindowRect (handle, &rect);
         int widthCombo = rect.right - rect.left, heightCombo = rect.bottom - rect.top;
         int uFlags = OS.SWP_NOMOVE | OS.SWP_NOZORDER | OS.SWP_NOACTIVATE;
-        SetWindowPos (hwndText, 0, 0, 0, width - 1, height - 1, uFlags);
-        SetWindowPos (handle, 0, 0, 0, widthCombo - 1, heightCombo - 1, uFlags);
-        SetWindowPos (hwndText, 0, 0, 0, width, height, uFlags);
-        SetWindowPos (handle, 0, 0, 0, widthCombo, heightCombo, uFlags);
+        SetWindowPos (hwndText, null, 0, 0, width - 1, height - 1, uFlags);
+        SetWindowPos (handle, null, 0, 0, widthCombo - 1, heightCombo - 1, uFlags);
+        SetWindowPos (hwndText, null, 0, 0, width, height, uFlags);
+        SetWindowPos (handle, null, 0, 0, widthCombo, heightCombo, uFlags);
         OS.InvalidateRect (handle, null, true);
     }
-    if (hwndList !is 0) {
+    if (hwndList !is null) {
         int bits1 = OS.GetWindowLong (hwndList, OS.GWL_EXSTYLE);
         if ((style & DWT.RIGHT_TO_LEFT) !is 0) {
             bits1 |= OS.WS_EX_LAYOUTRTL;
@@ -1637,26 +1658,26 @@
 
 void setScrollWidth () {
     int newWidth = 0;
-    RECT rect = new RECT ();
-    int newFont, oldFont = 0;
-    int hDC = OS.GetDC (handle);
-    newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
-    if (newFont !is 0) oldFont = OS.SelectObject (hDC, newFont);
+    RECT rect;
+    HFONT newFont, oldFont;
+    HDC hDC = OS.GetDC (handle);
+    newFont = cast(HFONT) OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
+    if (newFont !is null) oldFont = OS.SelectObject (hDC, newFont);
     int cp = getCodePage ();
     int count = OS.SendMessage (handle, OS.CB_GETCOUNT, 0, 0);
     int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE | OS.DT_NOPREFIX;
     for (int i=0; i<count; i++) {
-        int length = OS.SendMessage (handle, OS.CB_GETLBTEXTLEN, i, 0);
-        if (length !is OS.CB_ERR) {
-            TCHAR buffer = new TCHAR (cp, length + 1);
-            int result = OS.SendMessage (handle, OS.CB_GETLBTEXT, i, buffer);
+        int length_ = OS.SendMessage (handle, OS.CB_GETLBTEXTLEN, i, 0);
+        if (length_ !is OS.CB_ERR) {
+            TCHAR[] buffer = new TCHAR [ length_ + 1];
+            int result = OS.SendMessage (handle, OS.CB_GETLBTEXT, i, buffer.ptr);
             if (result !is OS.CB_ERR) {
-                OS.DrawText (hDC, buffer, -1, rect, flags);
+                OS.DrawText (hDC, buffer.ptr, -1, &rect, flags);
                 newWidth = Math.max (newWidth, rect.right - rect.left);
             }
         }
     }
-    if (newFont !is 0) OS.SelectObject (hDC, oldFont);
+    if (newFont !is null) OS.SelectObject (hDC, oldFont);
     OS.ReleaseDC (handle, hDC);
     setScrollWidth (newWidth + 3);
 }
@@ -1672,15 +1693,15 @@
     if (count > 3) {
         int maxWidth = 0;
         if (OS.IsWinCE || OS.WIN32_VERSION < OS.VERSION (4, 10)) {
-            RECT rect = new RECT ();
-            OS.SystemParametersInfo (OS.SPI_GETWORKAREA, 0, rect, 0);
+            RECT rect;
+            OS.SystemParametersInfo (OS.SPI_GETWORKAREA, 0, &rect, 0);
             maxWidth = (rect.right - rect.left) / 4;
         } else {
-            int hmonitor = OS.MonitorFromWindow (handle, OS.MONITOR_DEFAULTTONEAREST);
-            MONITORINFO lpmi = new MONITORINFO ();
+            auto hmonitor = OS.MonitorFromWindow (handle, OS.MONITOR_DEFAULTTONEAREST);
+            MONITORINFO lpmi;
             lpmi.cbSize = MONITORINFO.sizeof;
-            OS.GetMonitorInfo (hmonitor, lpmi);
-            maxWidth = (lpmi.rcWork_right - lpmi.rcWork_left) / 4;
+            OS.GetMonitorInfo (hmonitor, &lpmi);
+            maxWidth = (lpmi.rcWork.right - lpmi.rcWork.left) / 4;
         }
         scroll = scrollWidth > maxWidth;
     }
@@ -1694,15 +1715,15 @@
     }
 }
 
-void setScrollWidth (TCHAR buffer, bool grow) {
-    RECT rect = new RECT ();
-    int newFont, oldFont = 0;
-    int hDC = OS.GetDC (handle);
-    newFont = OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
-    if (newFont !is 0) oldFont = OS.SelectObject (hDC, newFont);
+void setScrollWidth (TCHAR[] buffer, bool grow) {
+    RECT rect;
+    HFONT newFont, oldFont;
+    auto hDC = OS.GetDC (handle);
+    newFont = cast(HFONT) OS.SendMessage (handle, OS.WM_GETFONT, 0, 0);
+    if (newFont !is null) oldFont = OS.SelectObject (hDC, newFont);
     int flags = OS.DT_CALCRECT | OS.DT_SINGLELINE | OS.DT_NOPREFIX;
-    OS.DrawText (hDC, buffer, -1, rect, flags);
-    if (newFont !is 0) OS.SelectObject (hDC, oldFont);
+    OS.DrawText (hDC, buffer.ptr, -1, &rect, flags);
+    if (newFont !is null) OS.SelectObject (hDC, oldFont);
     OS.ReleaseDC (handle, hDC);
     setScrollWidth (rect.right - rect.left, grow);
 }
@@ -1766,7 +1787,7 @@
  *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
  * </ul>
  */
-public void setText (String string) {
+public void setText (char[] string) {
     checkWidget ();
     if (string is null) error (DWT.ERROR_NULL_ARGUMENT);
     if ((style & DWT.READ_ONLY) !is 0) {
@@ -1775,12 +1796,12 @@
         return;
     }
     int limit = LIMIT;
-    int hwndText = OS.GetDlgItem (handle, CBID_EDIT);
-    if (hwndText !is 0) {
+    auto hwndText = OS.GetDlgItem (handle, CBID_EDIT);
+    if (hwndText !is null) {
         limit = OS.SendMessage (hwndText, OS.EM_GETLIMITTEXT, 0, 0);
     }
-    if (string.length () > limit) string = string.substring (0, limit);
-    TCHAR buffer = new TCHAR (getCodePage (), string, true);
+    if (string.length  > limit) string = string.substring (0, limit);
+    TCHAR* buffer = StrToTCHARz( string );
     if (OS.SetWindowText (handle, buffer)) {
         sendEvent (DWT.Modify);
         // widget could be disposed at this point
@@ -1813,11 +1834,11 @@
     OS.SendMessage (handle, OS.CB_LIMITTEXT, limit, 0);
 }
 
-void setToolTipText (Shell shell, String string) {
-    int hwndText = OS.GetDlgItem (handle, CBID_EDIT);
-    int hwndList = OS.GetDlgItem (handle, CBID_LIST);
-    if (hwndText !is 0) shell.setToolTipText (hwndText, string);
-    if (hwndList !is 0) shell.setToolTipText (hwndList, string);
+void setToolTipText (Shell shell, char[] string) {
+    auto hwndText = OS.GetDlgItem (handle, CBID_EDIT);
+    auto hwndList = OS.GetDlgItem (handle, CBID_LIST);
+    if (hwndText !is null) shell.setToolTipText (hwndText, string);
+    if (hwndList !is null) shell.setToolTipText (hwndList, string);
     shell.setToolTipText (handle, string);
 }
 
@@ -1844,8 +1865,8 @@
     visibleCount = count;
     if ((style & DWT.DROP_DOWN) !is 0) {
         forceResize ();
-        RECT rect = new RECT ();
-        OS.GetWindowRect (handle, rect);
+        RECT rect;
+        OS.GetWindowRect (handle, &rect);
         int flags = OS.SWP_NOMOVE | OS.SWP_NOZORDER | OS.SWP_DRAWFRAME | OS.SWP_NOACTIVATE;
         setBounds (0, 0, rect.right - rect.left, rect.bottom - rect.top, flags);
     }
@@ -1853,18 +1874,18 @@
 
 void subclass () {
     super.subclass ();
-    int newProc = display.windowProc;
-    int hwndText = OS.GetDlgItem (handle, CBID_EDIT);
-    if (hwndText !is 0) {
+    auto newProc = display.windowProc;
+    auto hwndText = OS.GetDlgItem (handle, CBID_EDIT);
+    if (hwndText !is null) {
         OS.SetWindowLong (hwndText, OS.GWL_WNDPROC, newProc);
     }
-    int hwndList = OS.GetDlgItem (handle, CBID_LIST);
-    if (hwndList !is 0) {
+    auto hwndList = OS.GetDlgItem (handle, CBID_LIST);
+    if (hwndList !is null) {
         OS.SetWindowLong (hwndList, OS.GWL_WNDPROC, newProc);
     }
 }
 
-bool translateTraversal (MSG msg) {
+bool translateTraversal (MSG* msg) {
     /*
     * When the combo box is dropped down, allow return
     * to select an item in the list and escape to close
@@ -1904,17 +1925,17 @@
 
 void unsubclass () {
     super.unsubclass ();
-    int hwndText = OS.GetDlgItem (handle, CBID_EDIT);
-    if (hwndText !is 0 && EditProc !is 0) {
-        OS.SetWindowLong (hwndText, OS.GWL_WNDPROC, EditProc);
+    auto hwndText = OS.GetDlgItem (handle, CBID_EDIT);
+    if (hwndText !is null && EditProc !is null) {
+        OS.SetWindowLong (hwndText, OS.GWL_WNDPROC, cast(int) EditProc);
     }
-    int hwndList = OS.GetDlgItem (handle, CBID_LIST);
-    if (hwndList !is 0 && ListProc !is 0) {
-        OS.SetWindowLong (hwndList, OS.GWL_WNDPROC, ListProc);
+    auto hwndList = OS.GetDlgItem (handle, CBID_LIST);
+    if (hwndList !is null && ListProc !is null) {
+        OS.SetWindowLong (hwndList, OS.GWL_WNDPROC, cast(int) ListProc);
     }
 }
 
-String verifyText (String string, int start, int end, Event keyEvent) {
+char[] verifyText (char[] string, int start, int end, Event keyEvent) {
     Event event = new Event ();
     event.text = string;
     event.start = start;
@@ -1942,12 +1963,12 @@
 int wcsToMbcsPos (int wcsPos) {
     if (wcsPos <= 0) return 0;
     if (OS.IsUnicode) return wcsPos;
-    int hwndText = OS.GetDlgItem (handle, CBID_EDIT);
-    if (hwndText is 0) return wcsPos;
+    auto hwndText = OS.GetDlgItem (handle, CBID_EDIT);
+    if (hwndText is null) return wcsPos;
     int mbcsSize = OS.GetWindowTextLengthA (hwndText);
     if (mbcsSize is 0) return 0;
-    byte [] buffer = new byte [mbcsSize + 1];
-    OS.GetWindowTextA (hwndText, buffer, mbcsSize + 1);
+    char [] buffer = new char [mbcsSize + 1];
+    OS.GetWindowTextA (hwndText, buffer.ptr, mbcsSize + 1);
     int mbcsPos = 0, wcsCount = 0;
     while (mbcsPos < mbcsSize) {
         if (wcsPos is wcsCount) break;
@@ -1968,21 +1989,21 @@
     return bits | OS.CBS_DROPDOWN;
 }
 
-TCHAR windowClass () {
-    return ComboClass;
+char[] windowClass () {
+    return TCHARzToStr( ComboClass );
 }
 
 int windowProc () {
-    return ComboProc;
+    return cast(int) ComboProc;
 }
 
-int windowProc (int hwnd, int msg, int wParam, int lParam) {
-    if (handle is 0) return 0;
+override int windowProc (HWND hwnd, int msg, int wParam, int lParam) {
+    if (handle is null) return 0;
     if (hwnd !is handle) {
-        int hwndText = OS.GetDlgItem (handle, CBID_EDIT);
-        int hwndList = OS.GetDlgItem (handle, CBID_LIST);
-        if ((hwndText !is 0 && hwnd is hwndText) || (hwndList !is 0 && hwnd is hwndList)) {
-            LRESULT result = null;
+        auto hwndText = OS.GetDlgItem (handle, CBID_EDIT);
+        auto hwndList = OS.GetDlgItem (handle, CBID_LIST);
+        if ((hwndText !is null && hwnd is hwndText) || (hwndList !is null && hwnd is hwndList)) {
+            LRESULT result = LRESULT.NULL;
             switch (msg) {
                 /* Keyboard messages */
                 case OS.WM_CHAR:        result = wmChar (hwnd, wParam, lParam); break;
@@ -2030,14 +2051,14 @@
                     }
                     break;
             }
-            if (result !is null) return result.value;
+            if (result !is LRESULT.NULL) return result;
             return callWindowProc (hwnd, msg, wParam, lParam);
         }
     }
     if (msg is OS.CB_SETCURSEL) {
         if ((style & DWT.READ_ONLY) !is 0) {
             if (hooks (DWT.Verify) || filters (DWT.Verify)) {
-                String oldText = getText (), newText = null;
+                char[] oldText = getText (), newText = null;
                 if (wParam is -1) {
                     newText = "";
                 } else {
@@ -2045,12 +2066,12 @@
                         newText = getItem (wParam);
                     }
                 }
-                if (newText !is null && !newText.equals (oldText)) {
-                    int length = OS.GetWindowTextLength (handle);
+                if (newText !is null && newText!=/*eq*/oldText) {
+                    int length_ = OS.GetWindowTextLength (handle);
                     oldText = newText;
-                    newText = verifyText (newText, 0, length, null);
+                    newText = verifyText (newText, 0, length_, null);
                     if (newText is null) return 0;
-                    if (!newText.equals (oldText)) {
+                    if (newText!=/*eq*/oldText) {
                         int index = indexOf (newText);
                         if (index !is -1 && index !is wParam) {
                             return callWindowProc (handle, OS.CB_SETCURSEL, index, lParam);
@@ -2069,7 +2090,7 @@
 
 LRESULT WM_GETDLGCODE (int wParam, int lParam) {
     int code = callWindowProc (handle, OS.WM_GETDLGCODE, wParam, lParam);
-    return new LRESULT (code | OS.DLGC_WANTARROWS);
+    return cast( LRESULT )(code | OS.DLGC_WANTARROWS);
 }
 
 LRESULT WM_KILLFOCUS (int wParam, int lParam) {
@@ -2089,7 +2110,7 @@
     * Return NULL - Focus notification is
     * done in WM_COMMAND by CBN_KILLFOCUS.
     */
-    return null;
+    return LRESULT.NULL;
 }
 
 LRESULT WM_LBUTTONDOWN (int wParam, int lParam) {
@@ -2120,7 +2141,7 @@
     * Return NULL - Focus notification is
     * done by WM_COMMAND with CBN_SETFOCUS.
     */
-    return null;
+    return LRESULT.NULL;
 }
 
 LRESULT WM_SIZE (int wParam, int lParam) {
@@ -2134,13 +2155,13 @@
         LRESULT result = super.WM_SIZE (wParam, lParam);
         if (OS.IsWindowVisible (handle)) {
             if (OS.IsWinCE) {
-                int hwndText = OS.GetDlgItem (handle, CBID_EDIT);
-                if (hwndText !is 0) OS.InvalidateRect (hwndText, null, true);
-                int hwndList = OS.GetDlgItem (handle, CBID_LIST);
-                if (hwndList !is 0) OS.InvalidateRect (hwndList, null, true);
+                auto hwndText = OS.GetDlgItem (handle, CBID_EDIT);
+                if (hwndText !is null) OS.InvalidateRect (hwndText, null, true);
+                auto hwndList = OS.GetDlgItem (handle, CBID_LIST);
+                if (hwndList !is null) OS.InvalidateRect (hwndList, null, true);
             } else {
                 int uFlags = OS.RDW_ERASE | OS.RDW_INVALIDATE | OS.RDW_ALLCHILDREN;
-                OS.RedrawWindow (handle, null, 0, uFlags);
+                OS.RedrawWindow (handle, null, null, uFlags);
             }
         }
         return result;
@@ -2153,21 +2174,20 @@
     * match from the list.  The fix is to remember the original
     * text and reset it after the widget is resized.
     */
-    LRESULT result = null;
+    LRESULT result = LRESULT.NULL;
     if ((style & DWT.READ_ONLY) !is 0) {
         result = super.WM_SIZE (wParam, lParam);
     } else {
         int index = OS.SendMessage (handle, OS.CB_GETCURSEL, 0, 0);
         bool redraw = false;
-        TCHAR buffer = null;
-        int [] start = null, end = null;
+        TCHAR[] buffer = null;
+        int start, end;
         if (index is OS.CB_ERR) {
-            int length = OS.GetWindowTextLength (handle);
-            if (length !is 0) {
-                buffer = new TCHAR (getCodePage (), length + 1);
-                OS.GetWindowText (handle, buffer, length + 1);
-                start = new int [1];  end = new int [1];
-                OS.SendMessage (handle, OS.CB_GETEDITSEL, start, end);
+            int length_ = OS.GetWindowTextLength (handle);
+            if (length_ !is 0) {
+                buffer = new TCHAR[ length_ + 1];
+                OS.GetWindowText (handle, buffer.ptr, length_ + 1);
+                OS.SendMessage (handle, OS.CB_GETEDITSEL, &start, &end);
                 redraw = drawCount is 0 && OS.IsWindowVisible (handle);
                 if (redraw) setRedraw (false);
             }
@@ -2182,8 +2202,8 @@
         */
         if (isDisposed ()) return result;
         if (buffer !is null) {
-            OS.SetWindowText (handle, buffer);
-            int bits = (start [0] & 0xFFFF) | ((end [0] << 16) & 0xFFFF0000);
+            OS.SetWindowText (handle, buffer.ptr);
+            int bits = (start & 0xFFFF) | ((end << 16) & 0xFFFF0000);
             OS.SendMessage (handle, OS.CB_SETEDITSEL, 0, bits);
             if (redraw) setRedraw (true);
         }
@@ -2198,10 +2218,10 @@
     return result;
 }
 
-LRESULT wmChar (int hwnd, int wParam, int lParam) {
-    if (ignoreCharacter) return null;
+LRESULT wmChar (HWND hwnd, int wParam, int lParam) {
+    if (ignoreCharacter) return LRESULT.NULL;
     LRESULT result = super.wmChar (hwnd, wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     /*
     * Feature in Windows.  For some reason, when the
     * widget is a single line text widget, when the
@@ -2228,23 +2248,23 @@
     return result;
 }
 
-LRESULT wmClipboard (int hwndText, int msg, int wParam, int lParam) {
-    if ((style & DWT.READ_ONLY) !is 0) return null;
-    if (!hooks (DWT.Verify) && !filters (DWT.Verify)) return null;
+LRESULT wmClipboard (HWND hwndText, int msg, int wParam, int lParam) {
+    if ((style & DWT.READ_ONLY) !is 0) return LRESULT.NULL;
+    if (!hooks (DWT.Verify) && !filters (DWT.Verify)) return LRESULT.NULL;
     bool call = false;
-    int [] start = new int [1], end = new int [1];
-    String newText = null;
+    int start, end;
+    char[] newText = null;
     switch (msg) {
         case OS.WM_CLEAR:
         case OS.WM_CUT:
-            OS.SendMessage (hwndText, OS.EM_GETSEL, start, end);
-            if (start [0] !is end [0]) {
+            OS.SendMessage (hwndText, OS.EM_GETSEL, &start, &end);
+            if (start  !is end ) {
                 newText = "";
                 call = true;
             }
             break;
         case OS.WM_PASTE:
-            OS.SendMessage (hwndText, OS.EM_GETSEL, start, end);
+            OS.SendMessage (hwndText, OS.EM_GETSEL, &start, &end);
             newText = getClipboardText ();
             break;
         case OS.EM_UNDO:
@@ -2253,13 +2273,13 @@
                 ignoreModify = true;
                 OS.SendMessage (hwndText, OS.EM_GETSEL, start, end);
                 OS.CallWindowProc (EditProc, hwndText, msg, wParam, lParam);
-                int length = OS.GetWindowTextLength (hwndText);
-                int [] newStart = new int [1], newEnd = new int [1];
-                OS.SendMessage (hwndText, OS.EM_GETSEL, newStart, newEnd);
-                if (length !is 0 && newStart [0] !is newEnd [0]) {
-                    TCHAR buffer = new TCHAR (getCodePage (), length + 1);
-                    OS.GetWindowText (hwndText, buffer, length + 1);
-                    newText = buffer.toString (newStart [0], newEnd [0] - newStart [0]);
+                int length_ = OS.GetWindowTextLength (hwndText);
+                int newStart, newEnd;
+                OS.SendMessage (hwndText, OS.EM_GETSEL, &newStart, &newEnd);
+                if (length_ !is 0 && newStart  !is newEnd ) {
+                    TCHAR[] buffer = new TCHAR [ length_ + 1];
+                    OS.GetWindowText (hwndText, buffer.ptr, length_ + 1);
+                    newText = TCHARsToStr( buffer[newStart .. newEnd - newStart ] );
                 } else {
                     newText = "";
                 }
@@ -2268,38 +2288,40 @@
             }
             break;
         case OS.WM_SETTEXT:
-            end [0] = OS.GetWindowTextLength (hwndText);
-            int length = OS.IsUnicode ? OS.wcslen (lParam) : OS.strlen (lParam);
-            TCHAR buffer = new TCHAR (getCodePage (), length);
-            int byteCount = buffer.length () * TCHAR.sizeof;
-            OS.MoveMemory (buffer, lParam, byteCount);
-            newText = buffer.toString (0, length);
+            end = OS.GetWindowTextLength (hwndText);
+            //int length_ = OS.IsUnicode ? OS.wcslen (lParam) : OS.strlen (lParam);
+            //TCHAR buffer = new TCHAR (getCodePage (), length_);
+            //int byteCount = buffer.length  * TCHAR.sizeof;
+            //OS.MoveMemory (buffer, lParam, byteCount);
+            //newText = buffer.toString (0, length_);
+            newText = TCHARzToStr( cast(TCHAR*)lParam );
             break;
     }
     if (newText !is null) {
-        String oldText = newText;
-        newText = verifyText (newText, start [0], end [0], null);
+        char[] oldText = newText;
+        newText = verifyText (newText, start, end, null);
         if (newText is null) return LRESULT.ZERO;
-        if (!newText.equals (oldText)) {
+        if (newText!=/*eq*/oldText) {
             if (call) {
                 OS.CallWindowProc (EditProc, hwndText, msg, wParam, lParam);
             }
-            TCHAR buffer = new TCHAR (getCodePage (), newText, true);
             if (msg is OS.WM_SETTEXT) {
-                int hHeap = OS.GetProcessHeap ();
-                int byteCount = buffer.length () * TCHAR.sizeof;
-                int pszText = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
-                OS.MoveMemory (pszText, buffer, byteCount);
-                int code = OS.CallWindowProc (EditProc, hwndText, msg, wParam, pszText);
+                TCHAR[] buffer = StrToTCHARs( newText );
+                auto hHeap = OS.GetProcessHeap ();
+                int byteCount = buffer.length * TCHAR.sizeof;
+                auto pszText = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
+                OS.MoveMemory (pszText, buffer.ptr, byteCount);
+                int code = OS.CallWindowProc (EditProc, hwndText, msg, wParam, cast(int) pszText);
                 OS.HeapFree (hHeap, 0, pszText);
-                return new LRESULT (code);
+                return cast( LRESULT )(code);
             } else {
+                TCHAR* buffer = StrToTCHARz( newText );
                 OS.SendMessage (hwndText, OS.EM_REPLACESEL, 0, buffer);
                 return LRESULT.ZERO;
             }
         }
     }
-    return null;
+    return LRESULT.NULL;
 }
 
 LRESULT wmCommandChild (int wParam, int lParam) {
@@ -2367,7 +2389,7 @@
     return super.wmCommandChild (wParam, lParam);
 }
 
-LRESULT wmIMEChar (int hwnd, int wParam, int lParam) {
+LRESULT wmIMEChar (HWND hwnd, int wParam, int lParam) {
 
     /* Process a DBCS character */
     Display display = this.display;
@@ -2387,24 +2409,24 @@
     */
     ignoreCharacter = true;
     int result = callWindowProc (hwnd, OS.WM_IME_CHAR, wParam, lParam);
-    MSG msg = new MSG ();
+    MSG msg;
     int flags = OS.PM_REMOVE | OS.PM_NOYIELD | OS.PM_QS_INPUT | OS.PM_QS_POSTMESSAGE;
-    while (OS.PeekMessage (msg, hwnd, OS.WM_CHAR, OS.WM_CHAR, flags)) {
-        OS.TranslateMessage (msg);
-        OS.DispatchMessage (msg);
+    while (OS.PeekMessage (&msg, hwnd, OS.WM_CHAR, OS.WM_CHAR, flags)) {
+        OS.TranslateMessage (&msg);
+        OS.DispatchMessage (&msg);
     }
     ignoreCharacter = false;
 
     sendKeyEvent (DWT.KeyUp, OS.WM_IME_CHAR, wParam, lParam);
     // widget could be disposed at this point
     display.lastKey = display.lastAscii = 0;
-    return new LRESULT (result);
+    return cast( LRESULT )(result);
 }
 
-LRESULT wmKeyDown (int hwnd, int wParam, int lParam) {
-    if (ignoreCharacter) return null;
+LRESULT wmKeyDown (HWND hwnd, int wParam, int lParam) {
+    if (ignoreCharacter) return LRESULT.NULL;
     LRESULT result = super.wmKeyDown (hwnd, wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     ignoreDefaultSelection = false;
     if (wParam is OS.VK_RETURN) {
         if ((style & DWT.DROP_DOWN) !is 0) {
@@ -2416,7 +2438,7 @@
     return result;
 }
 
-LRESULT wmSysKeyDown (int hwnd, int wParam, int lParam) {
+LRESULT wmSysKeyDown (HWND hwnd, int wParam, int lParam) {
     /*
     * Feature in Windows.  When an editable combo box is dropped
     * down using Alt+Down and the text in the entry field partially
@@ -2426,7 +2448,7 @@
     */
     int oldSelection = OS.SendMessage (handle, OS.CB_GETCURSEL, 0, 0);
     LRESULT result = super.wmSysKeyDown (hwnd, wParam, lParam);
-    if (result !is null) return result;
+    if (result !is LRESULT.NULL) return result;
     if ((style & DWT.READ_ONLY) is 0) {
         if (wParam is OS.VK_DOWN) {
             int code = callWindowProc (hwnd, OS.WM_SYSKEYDOWN, wParam, lParam);
@@ -2437,11 +2459,10 @@
                 sendEvent (DWT.Selection);
                 if (isDisposed ()) return LRESULT.ZERO;
             }
-            return new LRESULT (code);
+            return cast( LRESULT )(code);
         }
     }
     return result;
 }
 
 }
-++/
\ No newline at end of file