Made all 16<->32 HWND conversions use explicit functions instead of
implicit type casts.
Moved a lot of 16-bit functions to the new wnd16.c file.
Changed DIALOGINFO structure handling to support 32-bit handles.

diff --git a/windows/struct32.c b/windows/struct32.c
index 853ab1f..3638b5f 100644
--- a/windows/struct32.c
+++ b/windows/struct32.c
@@ -5,11 +5,12 @@
  */
 
 #include "struct32.h"
+#include "win.h"
 #include "winerror.h"
 
 void STRUCT32_MSG16to32(const MSG16 *msg16,MSG *msg32)
 {
-	msg32->hwnd=(HWND)msg16->hwnd;
+	msg32->hwnd = WIN_Handle32(msg16->hwnd);
 	msg32->message=msg16->message;
 	msg32->wParam=msg16->wParam;
 	msg32->lParam=msg16->lParam;
@@ -20,7 +21,7 @@
 
 void STRUCT32_MSG32to16(const MSG *msg32,MSG16 *msg16)
 {
-	msg16->hwnd=(HWND16)msg32->hwnd;
+	msg16->hwnd = WIN_Handle16(msg32->hwnd);
 	msg16->message=msg32->message;
 	msg16->wParam=msg32->wParam;
 	msg16->lParam=msg32->lParam;
@@ -49,24 +50,25 @@
 
 void STRUCT32_WINDOWPOS32to16( const WINDOWPOS* from, WINDOWPOS16* to )
 {
-    to->hwnd            = (HWND16)from->hwnd;
-    to->hwndInsertAfter = (HWND16)from->hwndInsertAfter;
-    to->x               = (INT16)from->x;
-    to->y               = (INT16)from->y;
-    to->cx              = (INT16)from->cx;
-    to->cy              = (INT16)from->cy;
-    to->flags           = (UINT16)from->flags;
+    to->hwnd            = WIN_Handle16(from->hwnd);
+    to->hwndInsertAfter = WIN_Handle16(from->hwndInsertAfter);
+    to->x               = from->x;
+    to->y               = from->y;
+    to->cx              = from->cx;
+    to->cy              = from->cy;
+    to->flags           = from->flags;
 }
 
 void STRUCT32_WINDOWPOS16to32( const WINDOWPOS16* from, WINDOWPOS* to )
 {
-    to->hwnd            = (HWND)from->hwnd;
-    to->hwndInsertAfter = (HWND)from->hwndInsertAfter;
-    to->x               = (INT)from->x;
-    to->y               = (INT)from->y;
-    to->cx              = (INT)from->cx;
-    to->cy              = (INT)from->cy;
-    to->flags           = (UINT)from->flags;
+    to->hwnd            = WIN_Handle32(from->hwnd);
+    to->hwndInsertAfter = (from->hwndInsertAfter == (HWND16)-1) ?
+                           HWND_TOPMOST : WIN_Handle32(from->hwndInsertAfter);
+    to->x               = from->x;
+    to->y               = from->y;
+    to->cx              = from->cx;
+    to->cy              = from->cy;
+    to->flags           = from->flags;
 }
 
 /* The strings are not copied */
@@ -76,11 +78,11 @@
     to->lpCreateParams = from->lpCreateParams;
     to->hInstance      = (HINSTANCE16)from->hInstance;
     to->hMenu          = (HMENU16)from->hMenu;
-    to->hwndParent     = (HWND16)from->hwndParent;
-    to->cy             = (INT16)from->cy;
-    to->cx             = (INT16)from->cx;
-    to->y              = (INT16)from->y;
-    to->x              = (INT16)from->x;
+    to->hwndParent     = WIN_Handle16(from->hwndParent);
+    to->cy             = from->cy;
+    to->cx             = from->cx;
+    to->y              = from->y;
+    to->x              = from->x;
     to->style          = from->style;
     to->dwExStyle      = from->dwExStyle;
 }
@@ -91,11 +93,11 @@
     to->lpCreateParams = from->lpCreateParams;
     to->hInstance      = (HINSTANCE)from->hInstance;
     to->hMenu          = (HMENU)from->hMenu;
-    to->hwndParent     = (HWND)from->hwndParent;
-    to->cy             = (INT)from->cy;
-    to->cx             = (INT)from->cx;
-    to->y              = (INT)from->y;
-    to->x              = (INT)from->x;
+    to->hwndParent     = WIN_Handle32(from->hwndParent);
+    to->cy             = from->cy;
+    to->cx             = from->cx;
+    to->y              = from->y;
+    to->x              = from->x;
     to->style          = from->style;
     to->dwExStyle      = from->dwExStyle;
 }
@@ -105,11 +107,11 @@
                                       MDICREATESTRUCT16* to )
 {
     to->hOwner = (HINSTANCE16)from->hOwner;
-    to->x      = (INT16)from->x;     
-    to->y      = (INT16)from->y;     
-    to->cx     = (INT16)from->cx;    
-    to->cy     = (INT16)from->cy;    
-    to->style  = from->style; 
+    to->x      = from->x;
+    to->y      = from->y;
+    to->cx     = from->cx;
+    to->cy     = from->cy;
+    to->style  = from->style;
     to->lParam = from->lParam;
 }
 
@@ -117,11 +119,11 @@
                                       MDICREATESTRUCTA *to )
 {
     to->hOwner = (HINSTANCE)from->hOwner;
-    to->x      = (INT)from->x;     
-    to->y      = (INT)from->y;     
-    to->cx     = (INT)from->cx;    
-    to->cy     = (INT)from->cy;    
-    to->style  = from->style; 
+    to->x      = from->x;
+    to->y      = from->y;
+    to->cx     = from->cx;
+    to->cy     = from->cy;
+    to->style  = from->style;
     to->lParam = from->lParam;
 }