Index: trunk/src/user32/Makefile
===================================================================
--- trunk/src/user32/Makefile	(revision 7800)
+++ trunk/src/user32/Makefile	(revision 7801)
@@ -1,3 +1,3 @@
-# $Id: Makefile,v 1.98 2001-12-13 15:32:57 sandervl Exp $
+# $Id: Makefile,v 1.99 2002-02-05 17:58:58 sandervl Exp $
 
 #
@@ -62,4 +62,5 @@
 $(OBJDIR)\windowword.obj \
 $(OBJDIR)\windowmsg.obj \
+$(OBJDIR)\message.obj \
 $(OBJDIR)\winproc.obj \
 $(OBJDIR)\oslibmsg.obj \
Index: trunk/src/user32/dbglocal.cpp
===================================================================
--- trunk/src/user32/dbglocal.cpp	(revision 7800)
+++ trunk/src/user32/dbglocal.cpp	(revision 7801)
@@ -1,3 +1,3 @@
-/* $Id: dbglocal.cpp,v 1.7 2001-07-20 15:34:15 sandervl Exp $ */
+/* $Id: dbglocal.cpp,v 1.8 2002-02-05 17:58:58 sandervl Exp $ */
 
 /*
@@ -88,5 +88,6 @@
 "win32wbasenonclient",
 "win32wbaseprop",
-"dcrgn"
+"dcrgn",
+"message"
 };
 //******************************************************************************
Index: trunk/src/user32/dbglocal.h
===================================================================
--- trunk/src/user32/dbglocal.h	(revision 7800)
+++ trunk/src/user32/dbglocal.h	(revision 7801)
@@ -1,3 +1,3 @@
-/* $Id: dbglocal.h,v 1.6 2001-07-20 15:34:15 sandervl Exp $ */
+/* $Id: dbglocal.h,v 1.7 2002-02-05 17:58:59 sandervl Exp $ */
 
 /*
@@ -88,5 +88,6 @@
 #define DBG_win32wbaseprop       66
 #define DBG_dcrgn                67
-#define DBG_MAXFILES             68
+#define DBG_message              68
+#define DBG_MAXFILES             69
 
 extern USHORT DbgEnabledUSER32[DBG_MAXFILES];
Index: trunk/src/user32/message.cpp
===================================================================
--- trunk/src/user32/message.cpp	(revision 7801)
+++ trunk/src/user32/message.cpp	(revision 7801)
@@ -0,0 +1,606 @@
+/* $Id: message.cpp,v 1.1 2002-02-05 17:58:59 sandervl Exp $ */
+/*
+ * Win32 window message APIs for OS/2
+ *
+ * Copyright 1999-2002 Sander van Leeuwen
+ *
+ * Based on Wine Windows code (dlls\user\message.c) 20020122
+ *
+ * Window messaging support
+ *
+ * Copyright 2001 Alexandre Julliard
+ *
+ * Project Odin Software License can be found in LICENSE.TXT
+ *
+ */
+
+#include <odin.h>
+#include <odinwrap.h>
+#include <os2sel.h>
+
+#include <os2win.h>
+#include <misc.h>
+#include <win32wbase.h>
+#include <win.h>
+#include <heapstring.h>
+#include <handlemanager.h>
+#include "oslibutil.h"
+#include "oslibwin.h"
+#include "oslibmsg.h"
+#include "hook.h"
+
+#define DBG_LOCALLOG	DBG_message
+#include "dbglocal.h"
+
+ODINDEBUGCHANNEL(USER32-MESSAGE)
+
+#define WIN_GetFullHandle(a)	a
+
+#define is_broadcast(hwnd) 	(hwnd == HWND_BROADCAST || hwnd == HWND_TOPMOST)
+
+
+enum message_type
+{
+    MSG_ASCII,
+    MSG_UNICODE,
+    MSG_NOTIFY,
+    MSG_CALLBACK_ASCII,
+    MSG_CALLBACK_UNICODE,
+    MSG_OTHER_PROCESS,
+    MSG_POSTED_ASCII,
+    MSG_POSTED_UNICODE
+};
+
+/* structure to group all parameters for sent messages of the various kinds */
+struct send_message_info
+{
+    enum message_type type;
+    HWND              hwnd;
+    UINT              msg;
+    WPARAM            wparam;
+    LPARAM            lparam;
+    UINT              flags;      /* flags for SendMessageTimeout */
+    UINT              timeout;    /* timeout for SendMessageTimeout */
+    SENDASYNCPROC     callback;   /* callback function for SendMessageCallback */
+    ULONG_PTR         data;       /* callback data */
+};
+
+/***********************************************************************
+ *		broadcast_message_callback
+ *
+ * Helper callback for broadcasting messages.
+ */
+static BOOL CALLBACK broadcast_message_callback( HWND hwnd, LPARAM lparam )
+{
+    struct send_message_info *info = (struct send_message_info *)lparam;
+    if (!(GetWindowLongW( hwnd, GWL_STYLE ) & (WS_POPUP|WS_CAPTION))) return TRUE;
+    switch(info->type)
+    {
+    case MSG_UNICODE:
+        SendMessageTimeoutW( hwnd, info->msg, info->wparam, info->lparam,
+                             info->flags, info->timeout, NULL );
+        break;
+    case MSG_ASCII:
+        SendMessageTimeoutA( hwnd, info->msg, info->wparam, info->lparam,
+                             info->flags, info->timeout, NULL );
+        break;
+    case MSG_NOTIFY:
+        SendNotifyMessageW( hwnd, info->msg, info->wparam, info->lparam );
+        break;
+    case MSG_CALLBACK_ASCII:
+        SendMessageCallbackA( hwnd, info->msg, info->wparam, info->lparam,
+                              info->callback, info->data );
+        break;
+    case MSG_CALLBACK_UNICODE:
+        SendMessageCallbackW( hwnd, info->msg, info->wparam, info->lparam,
+                              info->callback, info->data );
+        break;
+    case MSG_POSTED_ASCII:
+        PostMessageA( hwnd, info->msg, info->wparam, info->lparam );
+        break;
+    case MSG_POSTED_UNICODE:
+        PostMessageW( hwnd, info->msg, info->wparam, info->lparam );
+        break;
+    default:
+        dprintf(("!ERROR!: broadcast_message_callback: bad type %d\n", info->type ));
+        DebugInt3();
+        break;
+    }
+    return TRUE;
+}
+/***********************************************************************
+ *           call_window_proc
+ *
+ * Call a window procedure and the corresponding hooks.
+ */
+static LRESULT call_window_proc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam, BOOL unicode )
+{
+    LRESULT result;
+    WNDPROC winproc;
+
+    /* first the WH_CALLWNDPROC hook */
+    if (HOOK_IsHooked( WH_CALLWNDPROC ))
+    {
+        CWPSTRUCT cwp;
+        cwp.lParam  = lparam;
+        cwp.wParam  = wparam;
+        cwp.message = msg;
+        cwp.hwnd    = WIN_GetFullHandle( hwnd );
+        if (unicode) HOOK_CallHooksW( WH_CALLWNDPROC, HC_ACTION, 1, (LPARAM)&cwp );
+        else HOOK_CallHooksA( WH_CALLWNDPROC, HC_ACTION, 1, (LPARAM)&cwp );
+        lparam = cwp.lParam;
+        wparam = cwp.wParam;
+        msg    = cwp.message;
+        hwnd   = cwp.hwnd;
+    }
+
+    /* now call the window procedure */
+    if (unicode)
+    {
+        if (!(winproc = (WNDPROC)GetWindowLongW( hwnd, GWL_WNDPROC ))) return 0;
+        result = CallWindowProcW( winproc, hwnd, msg, wparam, lparam );
+    }
+    else
+    {
+        if (!(winproc = (WNDPROC)GetWindowLongA( hwnd, GWL_WNDPROC ))) return 0;
+        result = CallWindowProcA( winproc, hwnd, msg, wparam, lparam );
+    }
+#ifdef __WIN32OS2__
+    //hittest caching
+    if(msg == WM_NCHITTEST) 
+    {
+        Win32BaseWindow *window = Win32BaseWindow::GetWindowFromHandle(hwnd);
+        if(window) {
+             window->setLastHitTestVal(result);
+             RELEASE_WNDOBJ(window);
+        }
+        else DebugInt3();
+    }
+#endif
+
+    /* and finally the WH_CALLWNDPROCRET hook */
+    if (HOOK_IsHooked( WH_CALLWNDPROCRET ))
+    {
+        CWPRETSTRUCT cwp;
+        cwp.lResult = result;
+        cwp.lParam  = lparam;
+        cwp.wParam  = wparam;
+        cwp.message = msg;
+        cwp.hwnd    = WIN_GetFullHandle( hwnd );
+        if (unicode) HOOK_CallHooksW( WH_CALLWNDPROCRET, HC_ACTION, 1, (LPARAM)&cwp );
+        else HOOK_CallHooksA( WH_CALLWNDPROCRET, HC_ACTION, 1, (LPARAM)&cwp );
+    }
+    return result;
+}
+/***********************************************************************
+ *		SendMessageTimeoutW  (USER32.@)
+ */
+LRESULT WINAPI SendMessageTimeoutW( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
+                                    UINT flags, UINT timeout, LPDWORD res_ptr )
+{
+    struct send_message_info info;
+    DWORD dest_tid, dest_pid;
+    LRESULT ret, result;
+
+    info.type    = MSG_UNICODE;
+    info.hwnd    = hwnd;
+    info.msg     = msg;
+    info.wparam  = wparam;
+    info.lparam  = lparam;
+    info.flags   = flags;
+    info.timeout = timeout;
+
+    if (is_broadcast(hwnd))
+    {
+        EnumWindows( broadcast_message_callback, (LPARAM)&info );
+        if (res_ptr) *res_ptr = 1;
+        return 1;
+    }
+
+    if (!(dest_tid = GetWindowThreadProcessId( hwnd, &dest_pid ))) return 0;
+
+    if (dest_tid == GetCurrentThreadId())
+    {
+        result = call_window_proc( hwnd, msg, wparam, lparam, TRUE );
+        ret = 1;
+    }
+    else
+    {
+        //otherwise use WinSendMsg to send it to the right process/thread
+        dprintf(("SendMessages (inter-process) %x %x %x %x", Win32ToOS2Handle(hwnd), msg, wparam, lparam));
+        ret = OSLibSendMessage(Win32ToOS2Handle(hwnd), msg, wparam, lparam, TRUE);
+    }
+
+    if (ret && res_ptr) *res_ptr = result;
+    return ret;
+}
+
+
+/***********************************************************************
+ *		SendMessageTimeoutA  (USER32.@)
+ */
+LRESULT WINAPI SendMessageTimeoutA( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam,
+                                    UINT flags, UINT timeout, LPDWORD res_ptr )
+{
+    struct send_message_info info;
+    DWORD dest_tid, dest_pid;
+    LRESULT ret, result;
+
+    info.type    = MSG_ASCII;
+    info.hwnd    = hwnd;
+    info.msg     = msg;
+    info.wparam  = wparam;
+    info.lparam  = lparam;
+    info.flags   = flags;
+    info.timeout = timeout;
+
+    if (is_broadcast(hwnd))
+    {
+        EnumWindows( broadcast_message_callback, (LPARAM)&info );
+        if (res_ptr) *res_ptr = 1;
+        return 1;
+    }
+
+    if (!(dest_tid = GetWindowThreadProcessId( hwnd, &dest_pid ))) return 0;
+
+    if (dest_tid == GetCurrentThreadId())
+    {
+        result = call_window_proc( hwnd, msg, wparam, lparam, FALSE );
+        ret = 1;
+    }
+    else
+    {
+        //otherwise use WinSendMsg to send it to the right process/thread
+        dprintf(("SendMessages (inter-process) %x %x %x %x", Win32ToOS2Handle(hwnd), msg, wparam, lparam));
+        ret = OSLibSendMessage(Win32ToOS2Handle(hwnd), msg, wparam, lparam, FALSE);
+    }
+    if (ret && res_ptr) *res_ptr = result;
+    return ret;
+}
+//******************************************************************************
+//******************************************************************************
+LRESULT WIN32API SendMessageA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+    LRESULT res = 0;
+    SendMessageTimeoutA(hwnd, msg, wParam, lParam, SMTO_NORMAL, INFINITE, (LPDWORD)&res);
+    return res;
+}
+//******************************************************************************
+//******************************************************************************
+LRESULT WIN32API SendMessageW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+    LRESULT res = 0;
+    SendMessageTimeoutW(hwnd, msg, wParam, lParam, SMTO_NORMAL, INFINITE, (LPDWORD)&res);
+    return res;
+}
+//******************************************************************************
+//******************************************************************************
+BOOL WIN32API PostMessageA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+  Win32BaseWindow *window;
+  HWND hwndOS2;
+
+    struct send_message_info info;
+    DWORD dest_tid;
+
+#if 0
+    if (is_pointer_message( msg ))
+    {
+        SetLastError( ERROR_INVALID_PARAMETER );
+        return FALSE;
+    }
+#endif
+
+    info.type   = MSG_POSTED_ASCII;
+    info.hwnd   = hwnd;
+    info.msg    = msg;
+    info.wparam = wParam;
+    info.lparam = lParam;
+
+    if (is_broadcast(hwnd))
+    {
+        EnumWindows( broadcast_message_callback, (LPARAM)&info );
+        return TRUE;
+    }
+
+    if(hwnd == NULL)
+        return PostThreadMessageA(GetCurrentThreadId(), msg, wParam, lParam);
+
+    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
+    if(!window) {
+        dprintf(("PostMessageA, window %x not found", hwnd));
+        return FALSE;
+    }
+    hwndOS2 = window->getOS2WindowHandle();
+    RELEASE_WNDOBJ(window);
+    dprintf(("PostMessageA, %x %x %x %x", hwnd, msg, wParam, lParam));
+    return OSLibPostMessage(hwndOS2, msg, wParam, lParam, FALSE);
+}
+//******************************************************************************
+//******************************************************************************
+BOOL WIN32API PostMessageW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+  Win32BaseWindow *window;
+  HWND hwndOS2;
+
+    struct send_message_info info;
+    DWORD dest_tid;
+
+    info.type   = MSG_POSTED_UNICODE;
+    info.hwnd   = hwnd;
+    info.msg    = msg;
+    info.wparam = wParam;
+    info.lparam = lParam;
+
+    if (is_broadcast(hwnd))
+    {
+        EnumWindows( broadcast_message_callback, (LPARAM)&info );
+        return TRUE;
+    }
+
+    if(hwnd == NULL)
+        return PostThreadMessageW(GetCurrentThreadId(), msg, wParam, lParam);
+
+    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
+    if(!window) {
+        dprintf(("PostMessageW, window %x not found", hwnd));
+        return FALSE;
+    }
+    hwndOS2 = window->getOS2WindowHandle();
+    RELEASE_WNDOBJ(window);
+    dprintf(("PostMessageW, %x %x %x %x", hwnd, msg, wParam, lParam));
+    return OSLibPostMessage(hwndOS2, msg, wParam, lParam, TRUE);
+}
+//******************************************************************************
+//******************************************************************************
+BOOL WIN32API PostThreadMessageA( DWORD threadid, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+    return OSLibPostThreadMessage(threadid, msg, wParam, lParam, FALSE);
+}
+//******************************************************************************
+//******************************************************************************
+BOOL WIN32API PostThreadMessageW( DWORD threadid, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+    return OSLibPostThreadMessage(threadid, msg, wParam, lParam, TRUE);
+}
+//******************************************************************************
+//******************************************************************************
+BOOL WIN32API SendNotifyMessageA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+{
+    DWORD dest_tid;
+
+    dprintf(("USER32: SendNotifyMessageA %x %x %x %x", hwnd, Msg, wParam, lParam));
+
+    if (!(dest_tid = GetWindowThreadProcessId( hwnd, NULL ))) return FALSE;
+
+    if (dest_tid == GetCurrentThreadId())
+    {
+        SendMessageA( hwnd, Msg, wParam, lParam);
+        return TRUE;
+    }
+    //Must not block when window thread != current thread
+    return PostMessageA(hwnd, Msg, wParam, lParam);
+}
+//******************************************************************************
+//******************************************************************************
+BOOL WIN32API SendNotifyMessageW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
+{
+    DWORD dest_tid;
+
+    dprintf(("USER32: SendNotifyMessageW %x %x %x %x", hwnd, Msg, wParam, lParam));
+
+    if (!(dest_tid = GetWindowThreadProcessId( hwnd, NULL ))) return FALSE;
+
+    if (dest_tid == GetCurrentThreadId())
+    {
+        SendMessageW( hwnd, Msg, wParam, lParam);
+        return TRUE;
+    }
+    //Must not block when window thread != current thread
+    return PostMessageW(hwnd, Msg, wParam, lParam);
+}
+/*****************************************************************************
+ * Name      : BOOL WIN32API SendMessageCallbackA
+ * Purpose   : The SendMessageCallback function sends the specified message to
+ *             a window or windows. The function calls the window procedure for
+ *             the specified window and returns immediately. After the window
+ *             procedure processes the message, the system calls the specified
+ *             callback function, passing the result of the message processing
+ *             and an application-defined value to the callback function.
+ * Parameters: HWND  hwnd                      handle of destination window
+ *             UINT  uMsg                      message to send
+ *             WPARAM  wParam                  first message parameter
+ *             LPARAM  lParam                  second message parameter
+ *             SENDASYNCPROC  lpResultCallBack function to receive message value
+ *             DWORD  dwData                   value to pass to callback function
+ * Variables :
+ * Result    : If the function succeeds, the return value is TRUE.
+ *             If the function fails, the return value is FALSE. To get extended
+ *             error information, call GetLastError.
+ * Remark    :
+ * Status    : 
+ *
+ * Author    : Wine
+ *****************************************************************************/
+
+BOOL WIN32API SendMessageCallbackA(HWND          hwnd,
+                                   UINT          uMsg,
+                                   WPARAM        wParam,
+                                   LPARAM        lParam,
+                                   SENDASYNCPROC lpResultCallBack,
+                                   DWORD         dwData)
+{
+    struct send_message_info info;
+    LRESULT result;
+    DWORD dest_tid;
+
+#if 0
+    if (is_pointer_message(msg))
+    {
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return FALSE;
+    }
+#endif
+
+    dprintf(("USER32:SendMessageCallBackW (%08xh,%08xh,%08xh,%08xh,%08xh,%08x)",
+             hwnd, uMsg, wParam, lParam, lpResultCallBack, dwData));
+
+    info.type     = MSG_CALLBACK_ASCII;
+    info.hwnd     = hwnd;
+    info.msg      = uMsg;
+    info.wparam   = wParam;
+    info.lparam   = lParam;
+    info.callback = lpResultCallBack;
+    info.data     = dwData;
+
+    if (is_broadcast(hwnd))
+    {
+        EnumWindows( broadcast_message_callback, (LPARAM)&info );
+        return TRUE;
+    }
+
+    if (!(dest_tid = GetWindowThreadProcessId( hwnd, NULL ))) return FALSE;
+
+    if (dest_tid == GetCurrentThreadId())
+    {
+        result = call_window_proc( hwnd, uMsg, wParam, lParam, FALSE );
+        lpResultCallBack( hwnd, uMsg, dwData, result );
+        return TRUE;
+    }
+    else
+    {
+        dprintf(("!WARNING!: callback will not be called" ));
+
+        //otherwise use PostMessage to send it to the right process/thread
+        dprintf(("SendMessageCallbackA (inter-process) %x %x %x %x", hwnd, uMsg, wParam, lParam));
+        PostMessageA(hwnd, uMsg, wParam, lParam);
+        return TRUE;
+    }
+}
+
+
+/*****************************************************************************
+ * Name      : BOOL WIN32API SendMessageCallbackW
+ * Purpose   : The SendMessageCallback function sends the specified message to
+ *             a window or windows. The function calls the window procedure for
+ *             the specified window and returns immediately. After the window
+ *             procedure processes the message, the system calls the specified
+ *             callback function, passing the result of the message processing
+ *             and an application-defined value to the callback function.
+ * Parameters: HWND  hwnd                      handle of destination window
+ *             UINT  uMsg                      message to send
+ *             WPARAM  wParam                  first message parameter
+ *             LPARAM  lParam                  second message parameter
+ *             SENDASYNCPROC  lpResultCallBack function to receive message value
+ *             DWORD  dwData                   value to pass to callback function
+ * Variables :
+ * Result    : If the function succeeds, the return value is TRUE.
+ *             If the function fails, the return value is FALSE. To get extended
+ *             error information, call GetLastError.
+ * Remark    :
+ * Status    : 
+ *
+ * Author    : Wine
+ *****************************************************************************/
+
+BOOL WIN32API SendMessageCallbackW(HWND          hwnd,
+                                   UINT          uMsg,
+                                   WPARAM        wParam,
+                                   LPARAM        lParam,
+                                   SENDASYNCPROC lpResultCallBack,
+                                   DWORD         dwData)
+{
+    struct send_message_info info;
+    LRESULT result;
+    DWORD dest_tid;
+
+#if 0
+    if (is_pointer_message(msg))
+    {
+        SetLastError(ERROR_INVALID_PARAMETER);
+        return FALSE;
+    }
+#endif
+
+    dprintf(("USER32:SendMessageCallBackW (%08xh,%08xh,%08xh,%08xh,%08xh,%08x)",
+             hwnd, uMsg, wParam, lParam, lpResultCallBack, dwData));
+
+    info.type     = MSG_CALLBACK_UNICODE;
+    info.hwnd     = hwnd;
+    info.msg      = uMsg;
+    info.wparam   = wParam;
+    info.lparam   = lParam;
+    info.callback = lpResultCallBack;
+    info.data     = dwData;
+
+    if (is_broadcast(hwnd))
+    {
+        EnumWindows( broadcast_message_callback, (LPARAM)&info );
+        return TRUE;
+    }
+
+    if (!(dest_tid = GetWindowThreadProcessId( hwnd, NULL ))) return FALSE;
+
+    if (dest_tid == GetCurrentThreadId())
+    {
+        result = call_window_proc( hwnd, uMsg, wParam, lParam, TRUE );
+        lpResultCallBack( hwnd, uMsg, dwData, result );
+        return TRUE;
+    }
+    else
+    {
+        dprintf(("!WARNING!: callback will not be called" ));
+
+        //otherwise use PostMessage to send it to the right process/thread
+        dprintf(("SendMessageCallbackW (inter-process) %x %x %x %x", hwnd, uMsg, wParam, lParam));
+        PostMessageW(hwnd, uMsg, wParam, lParam);
+        return TRUE;
+    }
+}
+/*****************************************************************************
+ * Name      : long WIN32API BroadcastSystemMessage
+ * Purpose   : The BroadcastSystemMessage function sends a message to the given
+ *             recipients. The recipients can be applications, installable
+ *             drivers, Windows-based network drivers, system-level device
+ *             drivers, or any combination of these system components.
+ * Parameters: DWORD   dwFlags,
+               LPDWORD lpdwRecipients,
+               UINT    uiMessage,
+               WPARAM  wParam,
+               LPARAM  lParam
+ * Variables :
+ * Result    : If the function succeeds, the return value is a positive value.
+ *             If the function is unable to broadcast the message, the return value is -1.
+ *             If the dwFlags parameter is BSF_QUERY and at least one recipient returned FALSE to the corresponding message, the return value is zero.
+ * Remark    :
+ * Status    : UNTESTED STUB
+ *
+ * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
+ *****************************************************************************/
+
+long WIN32API BroadcastSystemMessage(DWORD   dwFlags,
+                                     LPDWORD lpdwRecipients,
+                                     UINT    uiMessage,
+                                     WPARAM  wParam,
+                                     LPARAM  lParam)
+{
+  dprintf(("USER32:BroadcastSystemMessage(%08xh,%08xh,%08xh,%08xh,%08x) not implemented.\n",
+        dwFlags,
+        lpdwRecipients,
+        uiMessage,
+        wParam,
+        lParam));
+
+  return (-1);
+}
+#if 0
+//******************************************************************************
+//******************************************************************************
+VOID WIN32API PostQuitMessage( int nExitCode)
+{
+    dprintf(("USER32: PostQuitMessage %d", nExitCode));
+    PostThreadMessageW(GetCurrentThreadId(), WM_QUIT, nExitCode, 0);
+}
+//******************************************************************************
+//******************************************************************************
+#endif
Index: trunk/src/user32/user32.cpp
===================================================================
--- trunk/src/user32/user32.cpp	(revision 7800)
+++ trunk/src/user32/user32.cpp	(revision 7801)
@@ -1,3 +1,3 @@
-/* $Id: user32.cpp,v 1.118 2001-12-26 19:05:35 achimha Exp $ */
+/* $Id: user32.cpp,v 1.119 2002-02-05 17:58:59 sandervl Exp $ */
 
 /*
@@ -1637,4 +1637,5 @@
          dwDesiredAccess));
 
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
   return (NULL);
 }
@@ -1670,4 +1671,5 @@
          dwDesiredAccess));
 
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
   return (NULL);
 }
@@ -1699,4 +1701,5 @@
          dwDesiredAccess));
 
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
   return (NULL);
 }
@@ -1727,4 +1730,5 @@
          dwDesiredAccess));
 
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
   return (NULL);
 }
@@ -1757,4 +1761,5 @@
          dwDesiredAccess));
 
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
   return (NULL);
 }
@@ -1781,4 +1786,5 @@
          hWinSta));
 
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
   return (FALSE);
 }
@@ -1803,4 +1809,5 @@
          hDesktop));
 
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
   return (FALSE);
 }
@@ -1833,4 +1840,5 @@
            cbInfo));
 
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
   return (FALSE);
 }
@@ -1863,4 +1871,5 @@
            cbInfo));
 
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
   return (FALSE);
 }
@@ -1890,4 +1899,5 @@
            psd));
 
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
   return (FALSE);
 }
@@ -1913,4 +1923,5 @@
          hDesktop));
 
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
   return (FALSE);
 }
Index: trunk/src/user32/win32dlg.cpp
===================================================================
--- trunk/src/user32/win32dlg.cpp	(revision 7800)
+++ trunk/src/user32/win32dlg.cpp	(revision 7801)
@@ -1,3 +1,3 @@
-/* $Id: win32dlg.cpp,v 1.75 2001-11-20 15:25:18 sandervl Exp $ */
+/* $Id: win32dlg.cpp,v 1.76 2002-02-05 17:59:00 sandervl Exp $ */
 /*
  * Win32 Dialog Code for OS/2
@@ -79,4 +79,6 @@
     }
 
+    dprintf(("Dialog style %x", LOWORD(dlgInfo.style)));
+
     /* Create custom font if needed */
     if (dlgInfo.style & DS_SETFONT)
@@ -248,5 +250,5 @@
 
     if (hUserFont)
-        SendInternalMessageA(WM_SETFONT, (WPARAM)hUserFont, 0 );
+        SendMessageA(getWindowHandle(), WM_SETFONT, (WPARAM)hUserFont, 0 );
 
     /* Create controls */
@@ -261,5 +263,5 @@
 
         HWND hwndPreInitFocus = GetFocus();
-        if(SendInternalMessageA(WM_INITDIALOG, (WPARAM)hwndFocus, param)) 
+        if(SendMessageA(getWindowHandle(), WM_INITDIALOG, (WPARAM)hwndFocus, param)) 
         {
             //SvL: Experiments in NT4 show that dialogs that are children don't
@@ -293,5 +295,6 @@
         {
             ShowWindow( SW_SHOWNORMAL );    /* SW_SHOW doesn't always work */
-            UpdateWindow( getWindowHandle() );
+////Note: this was removed in Wine
+////            UpdateWindow( getWindowHandle() );
         }
         SetLastError(ERROR_SUCCESS);
@@ -357,5 +360,5 @@
           {
                 if(!(getStyle() & DS_NOIDLEMSG))
-                    topOwner->SendMessageA(WM_ENTERIDLE,MSGF_DIALOGBOX,getWindowHandle());
+                    SendMessageA(topOwner->getWindowHandle(), WM_ENTERIDLE,MSGF_DIALOGBOX,getWindowHandle());
                 GetMessageA(&msg,0,0,0);
           }
@@ -757,5 +760,5 @@
         if ((rc == SIMPLEREGION) || (rc == COMPLEXREGION))
         {
-            HBRUSH hBrush = SendInternalMessageA(WM_CTLCOLORDLG, wParam, getWindowHandle());
+            HBRUSH hBrush = SendMessageA(getWindowHandle(), WM_CTLCOLORDLG, wParam, getWindowHandle());
             if(GetObjectType(hBrush) != OBJ_BRUSH) {
                 DefWndControlColor(CTLCOLOR_DLG, (HDC)wParam);
@@ -855,9 +858,9 @@
                 /* always make combo box hide its listbox control */
                 if( CONTROLS_IsControl( wndFocus, COMBOBOX_CONTROL ) )
-                    wndFocus->SendMessageA(CB_SHOWDROPDOWN, FALSE, 0 );
+                    SendMessageA(wndFocus->getWindowHandle(), CB_SHOWDROPDOWN, FALSE, 0 );
                 else
                 if( CONTROLS_IsControl( wndFocus, EDIT_CONTROL ) &&
                     CONTROLS_IsControl( wndFocus->getParent(), COMBOBOX_CONTROL ))
-                    wndFocus->SendMessageA(CB_SHOWDROPDOWN, FALSE, 0 );
+                    SendMessageA(wndFocus->getWindowHandle(), CB_SHOWDROPDOWN, FALSE, 0 );
                 RELEASE_WNDOBJ(wndFocus);
             }
Index: trunk/src/user32/win32wbase.cpp
===================================================================
--- trunk/src/user32/win32wbase.cpp	(revision 7800)
+++ trunk/src/user32/win32wbase.cpp	(revision 7801)
@@ -1,3 +1,3 @@
-/* $Id: win32wbase.cpp,v 1.312 2002-01-20 15:26:21 sandervl Exp $ */
+/* $Id: win32wbase.cpp,v 1.313 2002-02-05 17:59:00 sandervl Exp $ */
 /*
  * Win32 Window Base Class for OS/2
@@ -169,5 +169,4 @@
   fIsModalDialogOwner = FALSE;
   OS2HwndModalDialog  = 0;
-  fInternalMsg     = FALSE;
   fParentChange    = FALSE;
   fDestroyWindowCalled = FALSE;
@@ -212,8 +211,7 @@
   hotkey           = 0;
 
-
   hwndLinkAfter    = HWND_BOTTOM;
   flags            = 0;
-  lastHitTestVal   = HTOS_NORMAL;
+  lastHitTestVal   = HTCLIENT;
   owner            = NULL;
   windowClass      = 0;
@@ -846,7 +844,7 @@
             if(!(flags & WIN_NEED_SIZE))
             {
-                SendInternalMessageA(WM_SIZE, SIZE_RESTORED,
-                                MAKELONG(rectClient.right-rectClient.left,
-                                         rectClient.bottom-rectClient.top));
+                SendMessageA(getWindowHandle(), WM_SIZE, SIZE_RESTORED,
+                             MAKELONG(rectClient.right-rectClient.left,
+                             rectClient.bottom-rectClient.top));
 
                 if(!::IsWindow(hwnd))
@@ -855,5 +853,5 @@
                     goto end;
                 }
-                SendInternalMessageA(WM_MOVE,0,MAKELONG(rectClient.left,rectClient.top));
+                SendMessageA(getWindowHandle(), WM_MOVE,0,MAKELONG(rectClient.left,rectClient.top));
                 if(!::IsWindow(hwnd))
                 {
@@ -883,5 +881,5 @@
                 if(getParent() && getParent()->IsWindowDestroyed() == FALSE)
                 {
-                    getParent()->SendInternalMessageA(WM_PARENTNOTIFY, MAKEWPARAM(WM_CREATE, getWindowId()), (LPARAM)getWindowHandle());
+                    SendMessageA(getParent()->getWindowHandle(), WM_PARENTNOTIFY, MAKEWPARAM(WM_CREATE, getWindowId()), (LPARAM)getWindowHandle());
                 }
                 if(!::IsWindow(hwnd))
@@ -914,5 +912,5 @@
 ULONG Win32BaseWindow::MsgQuit()
 {
-  return SendInternalMessageA(WM_QUIT, 0, 0);
+  return SendMessageA(getWindowHandle(), WM_QUIT, 0, 0);
 }
 //******************************************************************************
@@ -920,5 +918,5 @@
 ULONG Win32BaseWindow::MsgClose()
 {
-  return SendInternalMessageA(WM_CLOSE,0,0);
+  return SendMessageA(getWindowHandle(), WM_CLOSE,0,0);
 }
 //******************************************************************************
@@ -940,15 +938,15 @@
             {
                     /* Notify the parent window only */
-                    getParent()->SendMessageA(WM_PARENTNOTIFY, MAKEWPARAM(WM_DESTROY, getWindowId()), (LPARAM)getWindowHandle());
+                    SendMessageA(getParent()->getWindowHandle(), WM_PARENTNOTIFY, MAKEWPARAM(WM_DESTROY, getWindowId()), (LPARAM)getWindowHandle());
             }
 ////            else    DebugInt3();
         }
     }
-    SendInternalMessageA(WM_DESTROY, 0, 0);
+    SendMessageA(getWindowHandle(),WM_DESTROY, 0, 0);
     if(::IsWindow(hwnd) == FALSE) {
         //object already destroyed, so return immediately
         return 1;
     }
-    SendInternalMessageA(WM_NCDESTROY, 0, 0);
+    SendMessageA(getWindowHandle(),WM_NCDESTROY, 0, 0);
 
     TIMER_KillTimerFromWindow(getWindowHandle());
@@ -979,5 +977,5 @@
     else dwStyle |= WS_DISABLED;
 
-    return SendInternalMessageA(WM_ENABLE, fEnable, 0);
+    return SendMessageA(getWindowHandle(),WM_ENABLE, fEnable, 0);
 }
 //******************************************************************************
@@ -999,5 +997,5 @@
 
     //already sent from ShowWindow
-////    return SendInternalMessageA(WM_SHOWWINDOW, fShow, 0);
+////    return SendMessageA(getWindowHandle(),WM_SHOWWINDOW, fShow, 0);
     return 0;
 }
@@ -1011,5 +1009,5 @@
         return 0;
 
-    return SendInternalMessageA(WM_WINDOWPOSCHANGING, 0, lp);
+    return SendMessageA(getWindowHandle(),WM_WINDOWPOSCHANGING, 0, lp);
 }
 //******************************************************************************
@@ -1022,5 +1020,5 @@
         return 1;
 
-    return SendInternalMessageA(WM_WINDOWPOSCHANGED, 0, lp);
+    return SendMessageA(getWindowHandle(),WM_WINDOWPOSCHANGED, 0, lp);
 }
 //******************************************************************************
@@ -1030,5 +1028,5 @@
   //According to the SDK docs, the scrollbar handle (lParam) is 0 when the standard
   //window scrollbars send these messages
-  return SendInternalMessageA(msg, MAKELONG(scrollCode, scrollPos), 0);
+  return SendMessageA(getWindowHandle(),msg, MAKELONG(scrollCode, scrollPos), 0);
 }
 //******************************************************************************
@@ -1046,5 +1044,5 @@
     //default processing is cancelled
     //TODO: According to Wine we should proceed anyway if window is sysmodal
-    if(SendInternalMessageA(WM_NCACTIVATE, fActivate, 0) == FALSE && !fActivate)
+    if(SendMessageA(getWindowHandle(),WM_NCACTIVATE, fActivate, 0) == FALSE && !fActivate)
     {
         dprintf(("WARNING: WM_NCACTIVATE return code = FALSE -> cancel processing"));
@@ -1055,10 +1053,10 @@
     {
         if(fActivate) {//WM_CHILDACTIVE is for activation only
-            SendInternalMessageA(WM_CHILDACTIVATE, 0, 0L);
+            SendMessageA(getWindowHandle(),WM_CHILDACTIVATE, 0, 0L);
         }
         return 0;
     }
 
-    return SendInternalMessageA(WM_ACTIVATE, MAKELONG((fActivate) ? WA_ACTIVE : WA_INACTIVE, fMinimized), hwnd);
+    return SendMessageA(getWindowHandle(),WM_ACTIVATE, MAKELONG((fActivate) ? WA_ACTIVE : WA_INACTIVE, fMinimized), hwnd);
 }
 //******************************************************************************
@@ -1074,5 +1072,5 @@
     //default processing is cancelled
     //TODO: According to Wine we should proceed anyway if window is sysmodal
-    if(SendInternalMessageA(WM_NCACTIVATE, fActivate, 0) == FALSE && !fActivate)
+    if(SendMessageA(getWindowHandle(),WM_NCACTIVATE, fActivate, 0) == FALSE && !fActivate)
     {
         dprintf(("WARNING: WM_NCACTIVATE return code = FALSE -> cancel processing"));
@@ -1083,5 +1081,5 @@
     {
         if(fActivate) {//WM_CHILDACTIVE is for activation only
-            SendInternalMessageA(WM_CHILDACTIVATE, 0, 0L);
+            SendMessageA(getWindowHandle(),WM_CHILDACTIVATE, 0, 0L);
         }
         return 0;
@@ -1094,5 +1092,5 @@
 ULONG Win32BaseWindow::DispatchMsgA(MSG *msg)
 {
-    return SendInternalMessageA(msg->message, msg->wParam, msg->lParam);
+    return SendMessageA(getWindowHandle(),msg->message, msg->wParam, msg->lParam);
 }
 //******************************************************************************
@@ -1100,5 +1098,5 @@
 ULONG Win32BaseWindow::DispatchMsgW(MSG *msg)
 {
-    return SendInternalMessageW(msg->message, msg->wParam, msg->lParam);
+    return SendMessageW(getWindowHandle(), msg->message, msg->wParam, msg->lParam);
 }
 //******************************************************************************
@@ -1111,5 +1109,5 @@
     }
 
-    return  SendInternalMessageA(WM_SETFOCUS, hwnd, 0);
+    return SendMessageA(getWindowHandle(),WM_SETFOCUS, hwnd, 0);
 }
 //******************************************************************************
@@ -1121,5 +1119,5 @@
         return 0;
     }
-    return  SendInternalMessageA(WM_KILLFOCUS, hwnd, 0);
+    return  SendMessageA(getWindowHandle(),WM_KILLFOCUS, hwnd, 0);
 }
 //******************************************************************************
@@ -1130,5 +1128,6 @@
 
     dprintf(("MsgButton %d at (%d,%d)", msg->message, msg->pt.x, msg->pt.y));
-    switch(msg->message) {
+    switch(msg->message) 
+    {
         case WM_LBUTTONDBLCLK:
         case WM_RBUTTONDBLCLK:
@@ -1167,6 +1166,6 @@
         if (hwndTop && (getWindowHandle() != hwndActive))
         {
-                LONG ret = SendInternalMessageA(WM_MOUSEACTIVATE, hwndTop,
-                                                MAKELONG( lastHitTestVal, msg->message) );
+                LONG ret = SendMessageA(getWindowHandle(),WM_MOUSEACTIVATE, hwndTop,
+                                        MAKELONG( lastHitTestVal, msg->message) );
 
                 dprintf2(("WM_MOUSEACTIVATE returned %d", ret));
@@ -1192,7 +1191,26 @@
     }
 
-    SendInternalMessageA(WM_SETCURSOR, getWindowHandle(), MAKELONG(lastHitTestVal, msg->message));
-
-    return  SendInternalMessageA(msg->message, msg->wParam, msg->lParam);
+    SendMessageA(getWindowHandle(),WM_SETCURSOR, getWindowHandle(), MAKELONG(lastHitTestVal, msg->message));
+
+    switch(msg->message) 
+    {
+        case WM_LBUTTONDOWN:
+        case WM_MBUTTONDOWN:
+        case WM_RBUTTONDOWN:
+        {
+                if (getParent())
+                {
+                    POINTS pt = MAKEPOINTS(msg->lParam);
+                    POINT point;
+
+                    point.x = pt.x;
+                    point.y = pt.y;
+                    MapWindowPoints(getWindowHandle(), getParent()->getWindowHandle(), &point, 1);
+                    NotifyParent(msg->message, msg->wParam, MAKELPARAM(point.x,point.y));
+                }
+                break;
+        }
+    }
+    return SendMessageA(getWindowHandle(),msg->message, msg->wParam, msg->lParam);
 }
 //******************************************************************************
@@ -1201,7 +1219,7 @@
 {
     if (select && IsWindowIconic())
-        return SendInternalMessageA(WM_PAINTICON, 1, 0);
+        return SendMessageA(getWindowHandle(),WM_PAINTICON, 1, 0);
     else
-        return SendInternalMessageA(WM_PAINT, 0, 0);
+        return SendMessageA(getWindowHandle(),WM_PAINT, 0, 0);
 }
 //******************************************************************************
@@ -1218,7 +1236,7 @@
 
     if(IsWindowIconic())
-        rc = SendInternalMessageA(WM_ICONERASEBKGND, hdcErase, 0);
+        rc = SendMessageA(getWindowHandle(),WM_ICONERASEBKGND, hdcErase, 0);
     else
-        rc = SendInternalMessageA(WM_ERASEBKGND, hdcErase, 0);
+        rc = SendMessageA(getWindowHandle(),WM_ERASEBKGND, hdcErase, 0);
     if (hdc == 0)
         ReleaseDC(getWindowHandle(), hdcErase);
@@ -1232,9 +1250,9 @@
     //SDK: WM_SETCURSOR is not sent if the mouse is captured
     if(GetCapture() == 0) {
-        SendInternalMessageA(WM_SETCURSOR, Win32Hwnd, MAKELONG(lastHitTestVal, msg->message));
+        SendMessageA(getWindowHandle(),WM_SETCURSOR, Win32Hwnd, MAKELONG(lastHitTestVal, msg->message));
     }
 
     //translated message == WM_(NC)MOUSEMOVE
-    return SendInternalMessageA(msg->message, msg->wParam, msg->lParam);
+    return SendMessageA(getWindowHandle(),msg->message, msg->wParam, msg->lParam);
 }
 //******************************************************************************
@@ -1264,5 +1282,5 @@
     hrgn = CreateRectRgnIndirect(pUpdateRect);
 
-    rc = SendInternalMessageA(WM_NCPAINT, hrgn, 0);
+    rc = SendMessageA(getWindowHandle(),WM_NCPAINT, hrgn, 0);
 
     DeleteObject(hrgn);
@@ -1355,5 +1373,5 @@
 ULONG Win32BaseWindow::MsgSetText(LPSTR lpsz, LONG cch)
 {
-    return SendInternalMessageA(WM_SETTEXT, 0, (LPARAM)lpsz);
+    return SendMessageA(getWindowHandle(),WM_SETTEXT, 0, (LPARAM)lpsz);
 }
 //******************************************************************************
@@ -1361,5 +1379,5 @@
 ULONG Win32BaseWindow::MsgGetTextLength()
 {
-    return SendInternalMessageA(WM_GETTEXTLENGTH, 0, 0);
+    return SendMessageA(getWindowHandle(),WM_GETTEXTLENGTH, 0, 0);
 }
 //******************************************************************************
@@ -1367,5 +1385,5 @@
 void Win32BaseWindow::MsgGetText(char *wndtext, ULONG textlength)
 {
-    SendInternalMessageA(WM_GETTEXT, textlength, (LPARAM)wndtext);
+    SendMessageA(getWindowHandle(),WM_GETTEXT, textlength, (LPARAM)wndtext);
 }
 //******************************************************************************
@@ -1508,5 +1526,5 @@
    */
   if ( uFlags & PRF_ERASEBKGND)
-    SendInternalMessageA(WM_ERASEBKGND, (WPARAM)hdc, 0);
+    SendMessageA(getWindowHandle(),WM_ERASEBKGND, (WPARAM)hdc, 0);
 
   /*
@@ -1514,5 +1532,5 @@
    */
   if ( uFlags & PRF_CLIENT)
-    SendInternalMessageA(WM_PRINTCLIENT, (WPARAM)hdc, PRF_CLIENT);
+    SendMessageA(getWindowHandle(),WM_PRINTCLIENT, (WPARAM)hdc, PRF_CLIENT);
 
 
@@ -1644,5 +1662,5 @@
         {
             if(getParent()) {
-                LRESULT rc = getParent()->SendInternalMessageA(WM_MOUSEACTIVATE, wParam, lParam );
+                LRESULT rc = SendMessageA(getParent()->getWindowHandle(), WM_MOUSEACTIVATE, wParam, lParam );
                 if(rc)  return rc;
             }
@@ -1666,5 +1684,5 @@
         {
             if(getParent()) {
-                LRESULT rc = getParent()->SendInternalMessageA(WM_SETCURSOR, wParam, lParam);
+                LRESULT rc = SendMessageA(getParent()->getWindowHandle(), WM_SETCURSOR, wParam, lParam);
                 if(rc)  return rc;
             }
@@ -1725,5 +1743,5 @@
         if (!(wpos->flags & SWP_NOMOVE) && !(wpos->flags & SWP_NOCLIENTMOVE))
         {
-            SendInternalMessageA(WM_MOVE, 0, MAKELONG(rectClient.left,rectClient.top));
+            SendMessageA(getWindowHandle(),WM_MOVE, 0, MAKELONG(rectClient.left,rectClient.top));
         }
         if (!(wpos->flags & SWP_NOSIZE) && !(wpos->flags & SWP_NOCLIENTSIZE))
@@ -1733,5 +1751,5 @@
             if (dwStyle & WS_MINIMIZE) wp = SIZE_MINIMIZED;
 
-            SendInternalMessageA(WM_SIZE, wp, MAKELONG(rectClient.right  - rectClient.left,
+            SendMessageA(getWindowHandle(),WM_SIZE, wp, MAKELONG(rectClient.right  - rectClient.left,
                                                        rectClient.bottom - rectClient.top));
         }
@@ -1872,5 +1890,5 @@
 	     else
 	        if( wParam == VK_ESCAPE && (GetKeyState(VK_SHIFT) & 0x8000))
-                    SendMessageW(WM_SYSCOMMAND, SC_KEYMENU, VK_SPACE );
+                    SendMessageW(getWindowHandle(), WM_SYSCOMMAND, SC_KEYMENU, VK_SPACE );
 
         Win32BaseWindow *siblingWindow;
@@ -1904,5 +1922,5 @@
             // key matches siblings mnemonic, send mouseclick
             if (mnemonic == (char) wParam) {
-                siblingWindow->SendInternalMessageA (BM_CLICK, 0, 0);
+                ::SendMessageA(siblingWindow->getWindowHandle(), BM_CLICK, 0, 0);
             }
             sibling = siblingWindow->GetNextWindow (GW_HWNDNEXT);
@@ -1938,5 +1956,5 @@
                         ::SendMessageW(GetParent(), Msg, wParam, lParam );
                 }
-                else    SendMessageA(WM_SYSCOMMAND, (WPARAM)SC_KEYMENU, (LPARAM)(DWORD)wParam );
+                else    ::SendMessageA(getWindowHandle(), WM_SYSCOMMAND, (WPARAM)SC_KEYMENU, (LPARAM)(DWORD)wParam );
         }
 #if 0
@@ -1956,5 +1974,5 @@
     case WM_CONTEXTMENU:
         if ((dwStyle & WS_CHILD) && getParent())
-          getParent()->SendInternalMessageA(WM_CONTEXTMENU,wParam,lParam);
+          SendMessageA(getParent()->getWindowHandle(), WM_CONTEXTMENU,wParam,lParam);
         return 0;
 
@@ -2029,5 +2047,5 @@
 
     case WM_HELP:
-        if (getParent()) getParent()->SendInternalMessageA(Msg,wParam,lParam);
+        if (getParent()) SendMessageA(getParent()->getWindowHandle(), Msg,wParam,lParam);
         break;
 
@@ -2121,230 +2139,4 @@
 //******************************************************************************
 //******************************************************************************
-LRESULT Win32BaseWindow::SendMessageA(ULONG Msg, WPARAM wParam, LPARAM lParam)
-{
-    //if the destination window is created by this process & thread, call window proc directly
-    if(dwProcessId == currentProcessId && dwThreadId == GetCurrentThreadId()) {
-        return SendInternalMessageA(Msg, wParam, lParam);
-    }
-    //otherwise use WinSendMsg to send it to the right process/thread
-    dprintf(("SendMessages (inter-process) %x %x %x %x", getWindowHandle(), Msg, wParam, lParam));
-    return OSLibSendMessage(getOS2WindowHandle(), Msg, wParam, lParam, FALSE);
-}
-//******************************************************************************
-//******************************************************************************
-LRESULT Win32BaseWindow::SendMessageW(ULONG Msg, WPARAM wParam, LPARAM lParam)
-{
-    //if the destination window is created by this process & thread, call window proc directly
-    if(dwProcessId == currentProcessId && dwThreadId == GetCurrentThreadId()) {
-        return SendInternalMessageW(Msg, wParam, lParam);
-    }
-    //otherwise use WinSendMsg to send it to the right process/thread
-    return OSLibSendMessage(getOS2WindowHandle(), Msg, wParam, lParam, TRUE);
-}
-//******************************************************************************
-//Called as a result of an OS/2 message or called from a class method
-//******************************************************************************
-LRESULT Win32BaseWindow::SendInternalMessageA(ULONG Msg, WPARAM wParam, LPARAM lParam)
-{
- LRESULT rc;
- HWND    hwnd = getWindowHandle();
- BOOL    fInternalMsgBackup = fInternalMsg;
-
-  //if the destination window was created by this process & thread, call window proc directly
-  if(dwProcessId != currentProcessId || dwThreadId != GetCurrentThreadId()) {
-        dprintf(("SendMessages (inter-process) %x %x %x %x", getWindowHandle(), Msg, wParam, lParam));
-        return OSLibSendMessage(getOS2WindowHandle(), Msg, wParam, lParam, FALSE);
-  }
-
-  DebugPrintMessage(getWindowHandle(), Msg, wParam, lParam, FALSE, TRUE);
-
-  CallWindowHookProc(WH_CALLWNDPROC, Msg, wParam, lParam, FALSE);
-
-  fInternalMsg = TRUE;
-  switch(Msg)
-  {
-        case WM_CREATE:
-        {
-                if(CallWindowProcA(win32wndproc, getWindowHandle(), WM_CREATE, 0, lParam) == -1) {
-                        dprintf(("WM_CREATE returned -1\n"));
-                        rc = -1; //don't create window
-                        break;
-                }
-                rc = 0;
-                break;
-        }
-        case WM_LBUTTONDOWN:
-        case WM_MBUTTONDOWN:
-        case WM_RBUTTONDOWN:
-        {
-                if (getParent())
-                {
-                    POINTS pt = MAKEPOINTS(lParam);
-                    POINT point;
-
-                    point.x = pt.x;
-                    point.y = pt.y;
-                    MapWindowPoints(getWindowHandle(), getParent()->getWindowHandle(), &point, 1);
-                    NotifyParent(Msg,wParam,MAKELPARAM(point.x,point.y));
-                }
-                rc = win32wndproc(getWindowHandle(), Msg, wParam, lParam);
-                break;
-        }
-        case WM_NCHITTEST:
-                rc = lastHitTestVal = win32wndproc(getWindowHandle(), WM_NCHITTEST, wParam, lParam);
-                break;
-
-        case WM_DESTROY:
-                rc = win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0);
-                break;
-
-        default:
-                rc = CallWindowProcA(win32wndproc, getWindowHandle(), Msg, wParam, lParam);
-                break;
-  }
-  if(!::IsWindow(hwnd)) {
-        //window might have been destroyed by now. (this pointer invalid)
-        //we must return immediately
-        //(MS Visual C++ install heap corruption)
-        //TODO: could happen in several places here!!!!
-        return rc;
-  }
-  fInternalMsg = fInternalMsgBackup;
-  dprintf2(("SendMessageA %x %x %x %x returned %x", getWindowHandle(), Msg, wParam, lParam, rc));
-  return rc;
-}
-//******************************************************************************
-//Called as a result of an OS/2 message or called from a class method
-//******************************************************************************
-LRESULT Win32BaseWindow::SendInternalMessageW(ULONG Msg, WPARAM wParam, LPARAM lParam)
-{
- LRESULT rc;
- HWND    hwnd = getWindowHandle();
- BOOL    fInternalMsgBackup = fInternalMsg;
-
-  //if the destination window was created by this process & thread, call window proc directly
-  if(dwProcessId != currentProcessId || dwThreadId != GetCurrentThreadId()) {
-        dprintf(("SendMessages (inter-process) %x %x %x %x", getWindowHandle(), Msg, wParam, lParam));
-        return OSLibSendMessage(getOS2WindowHandle(), Msg, wParam, lParam, FALSE);
-  }
-
-  DebugPrintMessage(getWindowHandle(), Msg, wParam, lParam, TRUE, TRUE);
-
-  CallWindowHookProc(WH_CALLWNDPROC, Msg, wParam, lParam, TRUE);
-
-  fInternalMsg = TRUE;
-  switch(Msg)
-  {
-        case WM_CREATE:
-        {
-                if(CallWindowProcW(win32wndproc, getWindowHandle(), WM_CREATE, 0, lParam) == -1) {
-                        dprintf(("WM_CREATE returned -1\n"));
-                        rc = -1; //don't create window
-                        break;
-                }
-                rc = 0;
-                break;
-        }
-        case WM_LBUTTONDOWN:
-        case WM_MBUTTONDOWN:
-        case WM_RBUTTONDOWN:
-                NotifyParent(Msg, wParam, lParam);
-                rc = win32wndproc(getWindowHandle(), Msg, wParam, lParam);
-                break;
-
-        case WM_NCHITTEST:
-                rc = lastHitTestVal = win32wndproc(getWindowHandle(), WM_NCHITTEST, wParam, lParam);
-                break;
-
-        case WM_DESTROY:
-                rc = win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0);
-                break;
-        default:
-                rc = CallWindowProcW(win32wndproc, getWindowHandle(), Msg, wParam, lParam);
-                break;
-  }
-  if(!::IsWindow(hwnd)) {
-        //window might have been destroyed by now. (this pointer invalid)
-        //we must return immediately
-        //(MS Visual C++ install heap corruption)
-        //TODO: could happen in several places here!!!!
-        return rc;
-  }
-  fInternalMsg = fInternalMsgBackup;
-  dprintf2(("SendMessageW %x %x %x %x returned %x", getWindowHandle(), Msg, wParam, lParam, rc));
-  return rc;
-}
-//******************************************************************************
-//******************************************************************************
-void Win32BaseWindow::CallWindowHookProc(ULONG hooktype, ULONG Msg, WPARAM wParam, LPARAM lParam, BOOL fUnicode)
-{
- CWPSTRUCT cwp;
-
-    cwp.lParam  = lParam;
-    cwp.wParam  = wParam;
-    cwp.message = Msg;
-    cwp.hwnd    = getWindowHandle();
-
-    switch(hooktype) {
-    case WH_CALLWNDPROC:
-        if(fUnicode) {
-             HOOK_CallHooksW(WH_CALLWNDPROC, HC_ACTION, 1, (LPARAM)&cwp);
-        }
-        else HOOK_CallHooksA(WH_CALLWNDPROC, HC_ACTION, 1, (LPARAM)&cwp);
-        break;
-    }
-}
-//******************************************************************************
-//TODO: Do this more efficiently
-//******************************************************************************
-LRESULT Win32BaseWindow::BroadcastMessageA(int type, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- Win32BaseWindow *window;
- HWND hwnd = WNDHANDLE_MAGIC_HIGHWORD;
-
-    dprintf(("BroadCastMessageA %x %x %x %s", msg, wParam, lParam, (type == BROADCAST_SEND) ? "Send" : "Post"));
-
-    for(int i=0;i<MAX_WINDOW_HANDLES;i++) {
-        window = GetWindowFromHandle(hwnd++);
-        if(window) {
-            if ((window->getStyle() & WS_POPUP) || ((window->getStyle() & WS_CAPTION) == WS_CAPTION))
-            {
-                if(type == BROADCAST_SEND) {
-                        ::SendMessageA(window->getWindowHandle(), msg, wParam, lParam);
-                }
-                else    PostMessageA(window->getWindowHandle(), msg, wParam, lParam);
-            }
-            RELEASE_WNDOBJ(window);
-        }
-    }
-    return 0;
-}
-//******************************************************************************
-//TODO: Do this more efficiently
-//******************************************************************************
-LRESULT Win32BaseWindow::BroadcastMessageW(int type, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- Win32BaseWindow *window;
- HWND hwnd = WNDHANDLE_MAGIC_HIGHWORD;
-
-    dprintf(("BroadCastMessageW %x %x %x %s", msg, wParam, lParam, (type == BROADCAST_SEND) ? "Send" : "Post"));
-
-    for(int i=0;i<MAX_WINDOW_HANDLES;i++) {
-        window = GetWindowFromHandle(hwnd++);
-        if(window) {
-            if ((window->getStyle() & WS_POPUP) || ((window->getStyle() & WS_CAPTION) == WS_CAPTION))
-            {
-                if(type == BROADCAST_SEND) {
-                        ::SendMessageW(window->getWindowHandle(), msg, wParam, lParam);
-                }
-                else    PostMessageW(window->getWindowHandle(), msg, wParam, lParam);
-            }
-            RELEASE_WNDOBJ(window);
-        }
-    }
-    return 0;
-}
-//******************************************************************************
-//******************************************************************************
 void Win32BaseWindow::NotifyParent(UINT Msg, WPARAM wParam, LPARAM lParam)
 {
@@ -2359,5 +2151,5 @@
                 parentwindow = window->getParent();
                 if(parentwindow) {
-                        parentwindow->SendInternalMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, getWindowId()), lParam );
+                    SendMessageA(parentwindow->getWindowHandle(), WM_PARENTNOTIFY, MAKEWPARAM(Msg, getWindowId()), lParam );
                 }
         }
@@ -2491,5 +2283,5 @@
     if (showFlag != wasVisible)
     {
-        SendInternalMessageA(WM_SHOWWINDOW, showFlag, 0 );
+        SendMessageA(getWindowHandle(),WM_SHOWWINDOW, showFlag, 0 );
         if (!::IsWindow( getWindowHandle() )) goto END;
     }
@@ -2517,8 +2309,8 @@
             wParam = SIZE_MINIMIZED;
 
-        SendInternalMessageA(WM_SIZE, wParam,
+        SendMessageA(getWindowHandle(),WM_SIZE, wParam,
                      MAKELONG(rectClient.right-rectClient.left,
                               rectClient.bottom-rectClient.top));
-        SendInternalMessageA(WM_MOVE,0,MAKELONG(rectClient.left,rectClient.top));
+        SendMessageA(getWindowHandle(),WM_MOVE,0,MAKELONG(rectClient.left,rectClient.top));
     }
 //testestest
@@ -2721,5 +2513,5 @@
     rectWindow.top    += dy;
     rectWindow.bottom += dy;
-    SendInternalMessageA(WM_MOVE, 0, MAKELONG(rectClient.left, rectClient.top));
+    SendMessageA(getWindowHandle(),WM_MOVE, 0, MAKELONG(rectClient.left, rectClient.top));
     return TRUE;
 }
@@ -2751,5 +2543,5 @@
     WINDOWPOS wpOld = *wpos;
     if(!(wpos->flags & SWP_NOSENDCHANGING))
-        SendInternalMessageA(WM_WINDOWPOSCHANGING, 0, (LPARAM)wpos);
+        SendMessageA(getWindowHandle(),WM_WINDOWPOSCHANGING, 0, (LPARAM)wpos);
 
     if ((wpos->hwndInsertAfter != wpOld.hwndInsertAfter) ||
@@ -2759,5 +2551,5 @@
          SetWindowPos(wpos->hwndInsertAfter, wpos->x, wpos->y, wpos->cx, wpos->cy, wpos->flags | SWP_NOSENDCHANGING);
     }
-    else SendInternalMessageA(WM_WINDOWPOSCHANGED, 0, (LPARAM)wpos);
+    else SendMessageA(getWindowHandle(),WM_WINDOWPOSCHANGED, 0, (LPARAM)wpos);
 
     //Calculate invalid areas
@@ -2882,5 +2674,5 @@
         {
              /* Notify the parent window only */
-             getParent()->SendMessageA(WM_PARENTNOTIFY, MAKEWPARAM(WM_DESTROY, getWindowId()), (LPARAM)getWindowHandle());
+             SendMessageA(getParent()->getWindowHandle(), WM_PARENTNOTIFY, MAKEWPARAM(WM_DESTROY, getWindowId()), (LPARAM)getWindowHandle());
              if(!::IsWindow(hwnd) )
              {
@@ -2906,6 +2698,6 @@
     if (NULL != owner)
     {
-      if (owner->getLastActive() == hwnd)
-        owner->setLastActive( owner->getWindowHandle() );
+        if (owner->getLastActive() == hwnd)
+            owner->setLastActive( owner->getWindowHandle() );
     }
   
@@ -3096,4 +2888,5 @@
 //******************************************************************************
 //TODO: Should not enumerate children that are created during the enumeration!
+//TODO: Do this more efficiently
 //******************************************************************************
 BOOL Win32BaseWindow::EnumChildWindows(WNDENUMPROC lpfn, LPARAM lParam)
@@ -3176,19 +2969,26 @@
 BOOL Win32BaseWindow::EnumWindows(WNDENUMPROC lpfn, LPARAM lParam)
 {
- Win32BaseWindow *child = 0;
- BOOL   rc;
- HWND   hwnd;
+ Win32BaseWindow *window;
+ BOOL             rc;
+ HWND             hwnd = WNDHANDLE_MAGIC_HIGHWORD;
 
     dprintf(("EnumWindows %x %x", lpfn, lParam));
 
-    for (child = (Win32BaseWindow *)getFirstChild(); child; child = (Win32BaseWindow *)child->getNextChild())
-    {
-        hwnd = child->getWindowHandle();
-
-        dprintf2(("EnumWindows: Found Window %x", child->getWindowHandle()));
-        if((rc = lpfn(child->getWindowHandle(), lParam)) == FALSE) {
-            break;
-        }
-    }
+    for(int i=0;i<MAX_WINDOW_HANDLES;i++) 
+    {
+        window = GetWindowFromHandle(hwnd++);
+        if(window) 
+        {
+            if ((window->getStyle() & WS_POPUP) || ((window->getStyle() & WS_CAPTION) == WS_CAPTION))
+            {
+                dprintf2(("EnumWindows: Found Window %x", window->getWindowHandle()));
+                if((rc = lpfn(window->getWindowHandle(), lParam)) == FALSE) {
+                    break;
+                }
+            }
+            RELEASE_WNDOBJ(window);
+        }
+    }
+    if(window) RELEASE_WNDOBJ(window);
     return TRUE;
 }
@@ -3523,5 +3323,5 @@
     rc = (getStyle() & WS_DISABLED) != 0;
     if(rc && !fEnable) {
-        SendMessageA(WM_CANCELMODE, 0, 0);
+        SendMessageA(getWindowHandle(), WM_CANCELMODE, 0, 0);
     }
     OSLibWinEnableWindow(OS2HwndFrame, fEnable);
@@ -3624,9 +3424,10 @@
 {
     //if the destination window is created by this process, send message
-    if(dwProcessId == currentProcessId) {
+    if(dwProcessId == currentProcessId) 
+    {
         if(fUnicode) {
-             return SendInternalMessageW(WM_GETTEXTLENGTH,0,0);
-        }
-        else return SendInternalMessageA(WM_GETTEXTLENGTH,0,0);
+             return SendMessageW(getWindowHandle(), WM_GETTEXTLENGTH,0,0);
+        }
+        else return SendMessageA(getWindowHandle(), WM_GETTEXTLENGTH,0,0);
     }
     //else get data directory from window structure
@@ -3642,5 +3443,5 @@
     //if the destination window is created by this process, send message
     if(dwProcessId == currentProcessId) {
-        return SendInternalMessageA(WM_GETTEXT,(WPARAM)cch,(LPARAM)lpsz);
+        return SendMessageA(getWindowHandle(),WM_GETTEXT,(WPARAM)cch,(LPARAM)lpsz);
     }
   
@@ -3659,15 +3460,15 @@
     //if the destination window is created by this process, send message
     if(dwProcessId == currentProcessId) {
-        return SendInternalMessageW(WM_GETTEXT,(WPARAM)cch,(LPARAM)lpsz);
+        return ::SendMessageW(getWindowHandle(), WM_GETTEXT,(WPARAM)cch,(LPARAM)lpsz);
     }
     //else get data directory from window structure
-  if (!lpsz || !cch) 
-    return 0;
-  if (!windowNameW) 
-    lpsz[0] = 0;
-  else 
-    memcpy(lpsz, windowNameW, min( sizeof(WCHAR) * (windowNameLength+1), cch));
+    if (!lpsz || !cch) 
+        return 0;
+    if (!windowNameW) 
+        lpsz[0] = 0;
+    else 
+        memcpy(lpsz, windowNameW, min( sizeof(WCHAR) * (windowNameLength+1), cch));
            
-  return min(windowNameLength, cch);
+    return min(windowNameLength, cch);
 }
 //******************************************************************************
@@ -3676,5 +3477,5 @@
 BOOL Win32BaseWindow::SetWindowTextA(LPSTR lpsz)
 {
-    return SendInternalMessageA(WM_SETTEXT,0,(LPARAM)lpsz);
+    return SendMessageA(getWindowHandle(),WM_SETTEXT,0,(LPARAM)lpsz);
 }
 //******************************************************************************
@@ -3682,5 +3483,5 @@
 BOOL Win32BaseWindow::SetWindowTextW(LPWSTR lpsz)
 {
-    return SendInternalMessageW(WM_SETTEXT,0,(LPARAM)lpsz);
+    return SendMessageW(getWindowHandle(), WM_SETTEXT,0,(LPARAM)lpsz);
 }
 //******************************************************************************
@@ -3702,7 +3503,7 @@
                 ss.styleNew = value;
                 dprintf(("SetWindowLong GWL_EXSTYLE %x old %x new style %x", getWindowHandle(), dwExStyle, value));
-                SendInternalMessageA(WM_STYLECHANGING,GWL_EXSTYLE,(LPARAM)&ss);
+                SendMessageA(getWindowHandle(),WM_STYLECHANGING,GWL_EXSTYLE,(LPARAM)&ss);
                 setExStyle(ss.styleNew);
-                SendInternalMessageA(WM_STYLECHANGED,GWL_EXSTYLE,(LPARAM)&ss);
+                SendMessageA(getWindowHandle(),WM_STYLECHANGED,GWL_EXSTYLE,(LPARAM)&ss);
                 oldval = ss.styleOld;
                 break;
@@ -3727,7 +3528,7 @@
                 ss.styleOld = getStyle();
                 ss.styleNew = value | (ss.styleOld & WS_CHILD);
-                SendInternalMessageA(WM_STYLECHANGING,GWL_STYLE,(LPARAM)&ss);
+                SendMessageA(getWindowHandle(),WM_STYLECHANGING,GWL_STYLE,(LPARAM)&ss);
                 setStyle(ss.styleNew);
-                SendInternalMessageA(WM_STYLECHANGED,GWL_STYLE,(LPARAM)&ss);
+                SendMessageA(getWindowHandle(),WM_STYLECHANGED,GWL_STYLE,(LPARAM)&ss);
                 OSLibSetWindowStyle(getOS2FrameWindowHandle(), getOS2WindowHandle(), getStyle(), getExStyle());
 
Index: trunk/src/user32/win32wbase.h
===================================================================
--- trunk/src/user32/win32wbase.h	(revision 7800)
+++ trunk/src/user32/win32wbase.h	(revision 7801)
@@ -1,3 +1,3 @@
-/* $Id: win32wbase.h,v 1.138 2002-01-12 14:09:31 sandervl Exp $ */
+/* $Id: win32wbase.h,v 1.139 2002-02-05 17:59:01 sandervl Exp $ */
 /*
  * Win32 Window Base Class for OS/2
@@ -82,7 +82,4 @@
         ULONG           lParam;
 } POSTMSG_PACKET;
-
-#define BROADCAST_SEND          0
-#define BROADCAST_POST          1
 
 #define HAS_DLGFRAME(style,exStyle) \
@@ -190,4 +187,5 @@
 
          LONG   getLastHitTestVal()             { return lastHitTestVal; }
+         void   setLastHitTestVal(LONG hittest) { lastHitTestVal = hittest; }
 
          DWORD  getWindowContextHelpId()        { return contextHelpId; };
@@ -323,10 +321,4 @@
  SCROLLBAR_INFO *getScrollInfo(int nBar);
 
-       LRESULT  SendMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
-       LRESULT  SendMessageW(ULONG msg, WPARAM wParam, LPARAM lParam);
-static LRESULT  BroadcastMessageA(int type, UINT msg, WPARAM wParam, LPARAM lParam);
-static LRESULT  BroadcastMessageW(int type, UINT msg, WPARAM wParam, LPARAM lParam);
-       void     CallWindowHookProc(ULONG hooktype, ULONG Msg, WPARAM wParam, LPARAM lParam, BOOL fUnicode = FALSE);
-
        LRESULT  DefWindowProcA(UINT Msg, WPARAM wParam, LPARAM lParam);
        LRESULT  DefWindowProcW(UINT msg, WPARAM wParam, LPARAM lParam);
@@ -374,6 +366,4 @@
         BOOL  CreateWindowExA(CREATESTRUCTA *lpCreateStruct, ATOM classAtom);
 #endif
-       LRESULT  SendInternalMessageA(ULONG msg, WPARAM wParam, LPARAM lParam);
-       LRESULT  SendInternalMessageW(ULONG msg, WPARAM wParam, LPARAM lParam);
         void    Init();
 
@@ -417,6 +407,4 @@
                  fIsModalDialog:1,
                  fIsModalDialogOwner:1,
-                 fInternalMsg:1,         //Used to distinguish between messages
-                                         //sent by PM and those sent by apps
                  fParentChange:1,
                  fDestroyWindowCalled:1, //DestroyWindow was called for this window
Index: trunk/src/user32/win32wbasenonclient.cpp
===================================================================
--- trunk/src/user32/win32wbasenonclient.cpp	(revision 7800)
+++ trunk/src/user32/win32wbasenonclient.cpp	(revision 7801)
@@ -1,3 +1,3 @@
-/* $Id: win32wbasenonclient.cpp,v 1.37 2001-10-15 17:09:04 sandervl Exp $ */
+/* $Id: win32wbasenonclient.cpp,v 1.38 2002-02-05 17:59:01 sandervl Exp $ */
 /*
  * Win32 Window Base Class for OS/2 (non-client methods)
@@ -155,9 +155,9 @@
 
   if (wParam == HTMINBUTTON)
-    SendInternalMessageA(WM_SYSCOMMAND,SC_MINIMIZE,*(LPARAM*)&msg.pt);
+    SendMessageA(getWindowHandle(), WM_SYSCOMMAND,SC_MINIMIZE,*(LPARAM*)&msg.pt);
   else if (wParam == HTMAXBUTTON)
-    SendInternalMessageA(WM_SYSCOMMAND,IsZoomed(Win32Hwnd) ? SC_RESTORE:SC_MAXIMIZE,*(LPARAM*)&msg.pt);
+    SendMessageA(getWindowHandle(), WM_SYSCOMMAND,IsZoomed(Win32Hwnd) ? SC_RESTORE:SC_MAXIMIZE,*(LPARAM*)&msg.pt);
   else
-    SendInternalMessageA(WM_SYSCOMMAND,SC_CONTEXTHELP,*(LPARAM*)&msg.pt);
+    SendMessageA(getWindowHandle(), WM_SYSCOMMAND,SC_CONTEXTHELP,*(LPARAM*)&msg.pt);
 }
 //******************************************************************************
@@ -192,5 +192,5 @@
   ReleaseDC(Win32Hwnd,hdc);
   if (!pressed) return;
-  SendInternalMessageA(WM_SYSCOMMAND,SC_CLOSE,*(LPARAM*)&msg.pt);
+  SendMessageA(getWindowHandle(), WM_SYSCOMMAND,SC_CLOSE,*(LPARAM*)&msg.pt);
 }
 //******************************************************************************
@@ -273,5 +273,5 @@
             }
             if (GetActiveWindow() == hwndTopParent)
-                 SendInternalMessageA(WM_SYSCOMMAND,SC_MOVE+HTCAPTION,lParam);
+                 SendMessageA(getWindowHandle(), WM_SYSCOMMAND,SC_MOVE+HTCAPTION,lParam);
             else dprintf(("ACtive window (%x) != toplevel wnd %x", OSLibWinQueryActiveWindow(), hwndTopParent));
         }
@@ -279,5 +279,5 @@
             SetActiveWindow();
             if (GetActiveWindow() == hwndTopParent)
-                 SendInternalMessageA(WM_SYSCOMMAND,SC_MOVE+HTCAPTION,lParam);
+                 SendMessageA(getWindowHandle(), WM_SYSCOMMAND,SC_MOVE+HTCAPTION,lParam);
             else dprintf(("ACtive window (%x) != wnd %x", OSLibWinQueryActiveWindow(), getWindowHandle()));
         }
@@ -288,18 +288,18 @@
         if(dwStyle & WS_SYSMENU )
         {
-            SendInternalMessageA(WM_SYSCOMMAND,SC_MOUSEMENU+HTSYSMENU,lParam);
+            SendMessageA(getWindowHandle(), WM_SYSCOMMAND,SC_MOUSEMENU+HTSYSMENU,lParam);
         }
         break;
 
     case HTMENU:
-        SendInternalMessageA(WM_SYSCOMMAND,SC_MOUSEMENU,lParam);
+        SendMessageA(getWindowHandle(), WM_SYSCOMMAND,SC_MOUSEMENU,lParam);
         break;
 
     case HTHSCROLL:
-        SendInternalMessageA(WM_SYSCOMMAND,SC_HSCROLL+HTHSCROLL,lParam);
+        SendMessageA(getWindowHandle(), WM_SYSCOMMAND,SC_HSCROLL+HTHSCROLL,lParam);
         break;
 
     case HTVSCROLL:
-        SendInternalMessageA(WM_SYSCOMMAND,SC_VSCROLL+HTVSCROLL,lParam);
+        SendMessageA(getWindowHandle(), WM_SYSCOMMAND,SC_VSCROLL+HTVSCROLL,lParam);
         break;
 
@@ -323,5 +323,5 @@
     case HTBOTTOMRIGHT:
         /* make sure hittest fits into 0xf and doesn't overlap with HTSYSMENU */
-        SendInternalMessageA(WM_SYSCOMMAND,SC_SIZE+wParam-2,lParam);
+        SendMessageA(getWindowHandle(), WM_SYSCOMMAND,SC_SIZE+wParam-2,lParam);
         break;
     case HTBORDER:
@@ -1207,5 +1207,5 @@
   if (dwStyle & WS_MINIMIZE)
   {
-    SendInternalMessageA(WM_SYSCOMMAND,SC_RESTORE,lParam);
+    SendMessageA(getWindowHandle(), WM_SYSCOMMAND,SC_RESTORE,lParam);
     return 0;
   }
@@ -1216,5 +1216,5 @@
       /* stop processing if WS_MAXIMIZEBOX is missing */
       if (dwStyle & WS_MAXIMIZEBOX)
-        SendInternalMessageA(WM_SYSCOMMAND,
+        SendMessageA(getWindowHandle(), WM_SYSCOMMAND,
                       (dwStyle & WS_MAXIMIZE) ? SC_RESTORE : SC_MAXIMIZE,
                       lParam);
@@ -1223,13 +1223,13 @@
     case HTSYSMENU:
       if (!(GetClassWord(Win32Hwnd,GCW_STYLE) & CS_NOCLOSE))
-        SendInternalMessageA(WM_SYSCOMMAND,SC_CLOSE,lParam);
+        SendMessageA(getWindowHandle(), WM_SYSCOMMAND,SC_CLOSE,lParam);
       break;
 
     case HTHSCROLL:
-      SendInternalMessageA(WM_SYSCOMMAND,SC_HSCROLL+HTHSCROLL,lParam);
+      SendMessageA(getWindowHandle(), WM_SYSCOMMAND,SC_HSCROLL+HTHSCROLL,lParam);
       break;
 
     case HTVSCROLL:
-      SendInternalMessageA(WM_SYSCOMMAND,SC_VSCROLL+HTVSCROLL,lParam);
+      SendMessageA(getWindowHandle(), WM_SYSCOMMAND,SC_VSCROLL+HTVSCROLL,lParam);
       break;
   }
@@ -1249,5 +1249,5 @@
       if (((GetActiveWindow() == Win32Hwnd) || isMDIChild()) && (dwStyle & WS_SYSMENU))
       {
-        SendInternalMessageA(WM_SYSCOMMAND,SC_MOUSEMENU+HTCAPTION,lParam);
+        SendMessageA(getWindowHandle(), WM_SYSCOMMAND,SC_MOUSEMENU+HTCAPTION,lParam);
       }
       break;
@@ -1345,5 +1345,5 @@
 
     case SC_CLOSE:
-        return SendInternalMessageA(WM_CLOSE,0,0);
+        return SendMessageA(getWindowHandle(), WM_CLOSE,0,0);
 
     case SC_CONTEXTHELP:
Index: trunk/src/user32/win32wbasepos.cpp
===================================================================
--- trunk/src/user32/win32wbasepos.cpp	(revision 7800)
+++ trunk/src/user32/win32wbasepos.cpp	(revision 7801)
@@ -1,3 +1,3 @@
-/* $Id: win32wbasepos.cpp,v 1.26 2001-06-09 14:50:22 sandervl Exp $ */
+/* $Id: win32wbasepos.cpp,v 1.27 2002-02-05 17:59:01 sandervl Exp $ */
 /*
  * Win32 Window Base Class for OS/2 (nonclient/position methods)
@@ -115,5 +115,5 @@
 //    }
 
-    SendInternalMessageA(WM_GETMINMAXINFO, 0, (LPARAM)&MinMax );
+    SendMessageA(getWindowHandle(), WM_GETMINMAXINFO, 0, (LPARAM)&MinMax );
 
       /* Some sanity checks */
@@ -163,5 +163,5 @@
         params.lppos = &winposCopy;
    }
-   result = SendInternalMessageA(WM_NCCALCSIZE, calcValidRect, (LPARAM)&params );
+   result = SendMessageA(getWindowHandle(), WM_NCCALCSIZE, calcValidRect, (LPARAM)&params );
 
    /* If the application send back garbage, ignore it */
@@ -293,5 +293,5 @@
         if(getStyle() & WS_MINIMIZE )
         {
-            if(!SendInternalMessageA(WM_QUERYOPEN, 0, 0L))
+            if(!SendMessageA(getWindowHandle(), WM_QUERYOPEN, 0, 0L))
                 return (SWP_NOSIZE | SWP_NOMOVE);
         }
Index: trunk/src/user32/windowmsg.cpp
===================================================================
--- trunk/src/user32/windowmsg.cpp	(revision 7800)
+++ trunk/src/user32/windowmsg.cpp	(revision 7801)
@@ -1,7 +1,7 @@
-/* $Id: windowmsg.cpp,v 1.32 2001-12-21 18:43:59 sandervl Exp $ */
+/* $Id: windowmsg.cpp,v 1.33 2002-02-05 17:59:02 sandervl Exp $ */
 /*
  * Win32 window message APIs for OS/2
  *
- * Copyright 1999 Sander van Leeuwen
+ * Copyright 1999-2001 Sander van Leeuwen
  *
  * Parts based on Wine Windows code (windows\message.c) 990508
@@ -37,11 +37,4 @@
 
 
-//******************************************************************************
-//******************************************************************************
-VOID WIN32API PostQuitMessage( int nExitCode)
-{
-    dprintf(("USER32:  PostQuitMessage\n"));
-    OSLibWinPostQuitMessage(nExitCode);
-}
 //******************************************************************************
 //******************************************************************************
@@ -172,112 +165,4 @@
 //******************************************************************************
 //******************************************************************************
-LRESULT WIN32API SendMessageA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
-  Win32BaseWindow *window;
-  LRESULT result;
-
-    if (hwnd == HWND_BROADCAST|| hwnd == HWND_TOPMOST)
-    {
-        Win32BaseWindow::BroadcastMessageA(BROADCAST_SEND, msg, wParam, lParam);
-        return TRUE;
-    }
-
-    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
-    if(!window) {
-        dprintf(("SendMessageA, %x %x %x window %x not found", msg, wParam, lParam, hwnd));
-        return 0;
-    }
-    result = window->SendMessageA(msg, wParam, lParam);
-    RELEASE_WNDOBJ(window);
-    return result;
-}
-//******************************************************************************
-//******************************************************************************
-LRESULT WIN32API SendMessageW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
-  Win32BaseWindow *window;
-  LRESULT result;
-
-    if (hwnd == HWND_BROADCAST|| hwnd == HWND_TOPMOST)
-    {
-        Win32BaseWindow::BroadcastMessageW(BROADCAST_SEND, msg, wParam, lParam);
-        return TRUE;
-    }
-
-    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
-    if(!window) {
-        dprintf(("SendMessageW, window %x not found", hwnd));
-        return 0;
-    }
-    result = window->SendMessageW(msg, wParam, lParam);
-    RELEASE_WNDOBJ(window);
-    return result;
-}
-//******************************************************************************
-//******************************************************************************
-BOOL WIN32API PostMessageA(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
-  Win32BaseWindow *window;
-  HWND hwndOS2;
-
-    if (hwnd == HWND_BROADCAST) //Not HWND_TOPMOST???
-    {
-        Win32BaseWindow::BroadcastMessageA(BROADCAST_POST, msg, wParam, lParam);
-        return TRUE;
-    }
-
-    if(hwnd == NULL)
-        return PostThreadMessageA(GetCurrentThreadId(), msg, wParam, lParam);
-
-    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
-    if(!window) {
-        dprintf(("PostMessageA, window %x not found", hwnd));
-        return FALSE;
-    }
-    hwndOS2 = window->getOS2WindowHandle();
-    RELEASE_WNDOBJ(window);
-    dprintf(("PostMessageA, %x %x %x %x", hwnd, msg, wParam, lParam));
-    return OSLibPostMessage(hwndOS2, msg, wParam, lParam, FALSE);
-}
-//******************************************************************************
-//******************************************************************************
-BOOL WIN32API PostMessageW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
-  Win32BaseWindow *window;
-  HWND hwndOS2;
-
-    if (hwnd == HWND_BROADCAST) //Not HWND_TOPMOST???
-    {
-        Win32BaseWindow::BroadcastMessageW(BROADCAST_POST, msg, wParam, lParam);
-        return TRUE;
-    }
-
-    if(hwnd == NULL)
-        return PostThreadMessageW(GetCurrentThreadId(), msg, wParam, lParam);
-
-    window = Win32BaseWindow::GetWindowFromHandle(hwnd);
-    if(!window) {
-        dprintf(("PostMessageW, window %x not found", hwnd));
-        return FALSE;
-    }
-    hwndOS2 = window->getOS2WindowHandle();
-    RELEASE_WNDOBJ(window);
-    dprintf(("PostMessageW, %x %x %x %x", hwnd, msg, wParam, lParam));
-    return OSLibPostMessage(hwndOS2, msg, wParam, lParam, TRUE);
-}
-//******************************************************************************
-//******************************************************************************
-BOOL WIN32API PostThreadMessageA( DWORD threadid, UINT msg, WPARAM wParam, LPARAM lParam)
-{
-    return OSLibPostThreadMessage(threadid, msg, wParam, lParam, FALSE);
-}
-//******************************************************************************
-//******************************************************************************
-BOOL WIN32API PostThreadMessageW( DWORD threadid, UINT msg, WPARAM wParam, LPARAM lParam)
-{
-    return OSLibPostThreadMessage(threadid, msg, wParam, lParam, TRUE);
-}
-//******************************************************************************
-//******************************************************************************
 BOOL WIN32API WaitMessage(void)
 {
@@ -298,4 +183,11 @@
     dprintf(("USER32: ReplyMessage %x", result));
     return OSLibWinReplyMessage(result);
+}
+//******************************************************************************
+//******************************************************************************
+VOID WIN32API PostQuitMessage( int nExitCode)
+{
+    dprintf(("USER32:  PostQuitMessage\n"));
+    OSLibWinPostQuitMessage(nExitCode);
 }
 //******************************************************************************
@@ -323,158 +215,4 @@
   dprintf(("USER32:  SetMessageQueue\n"));
   return(TRUE);
-}
-//******************************************************************************
-//******************************************************************************
-LRESULT WIN32API SendMessageTimeoutA(HWND hwnd, UINT Msg, WPARAM wParam,
-                    LPARAM lParam, UINT fuFlags, UINT uTimeOut,
-                    LPDWORD lpdwResult)
-{
-  dprintf(("USER32:  SendMessageTimeoutA, partially implemented\n"));
-  //ignore fuFlags & wTimeOut
-  *lpdwResult = SendMessageA(hwnd, Msg, wParam, lParam);
-  return(TRUE);
-}
-//******************************************************************************
-//******************************************************************************
-LRESULT WIN32API SendMessageTimeoutW(HWND hwnd, UINT Msg, WPARAM wParam,
-                    LPARAM lParam, UINT fuFlags, UINT uTimeOut,
-                    LPDWORD lpdwResult)
-{
-  dprintf(("USER32:  SendMessageTimeoutW, partially implemented\n"));
-  return(SendMessageTimeoutA(hwnd, Msg, wParam, lParam, fuFlags, uTimeOut, lpdwResult));
-}
-//******************************************************************************
-//******************************************************************************
-BOOL WIN32API SendNotifyMessageA(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
-{
-  dprintf(("USER32:  SendNotifyMessageA, not completely implemented\n"));
-  return(SendMessageA(hwnd, Msg, wParam, lParam));
-}
-//******************************************************************************
-//******************************************************************************
-BOOL WIN32API SendNotifyMessageW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam)
-{
-  dprintf(("USER32:  SendNotifyMessageW, not completely implemented\n"));
-  return(SendMessageA(hwnd, Msg, wParam, lParam));
-}
-/*****************************************************************************
- * Name      : BOOL WIN32API SendMessageCallbackA
- * Purpose   : The SendMessageCallback function sends the specified message to
- *             a window or windows. The function calls the window procedure for
- *             the specified window and returns immediately. After the window
- *             procedure processes the message, the system calls the specified
- *             callback function, passing the result of the message processing
- *             and an application-defined value to the callback function.
- * Parameters: HWND  hwnd                      handle of destination window
- *             UINT  uMsg                      message to send
- *             WPARAM  wParam                  first message parameter
- *             LPARAM  lParam                  second message parameter
- *             SENDASYNCPROC  lpResultCallBack function to receive message value
- *             DWORD  dwData                   value to pass to callback function
- * Variables :
- * Result    : If the function succeeds, the return value is TRUE.
- *             If the function fails, the return value is FALSE. To get extended
- *             error information, call GetLastError.
- * Remark    :
- * Status    : UNTESTED STUB
- *
- * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
- *****************************************************************************/
-
-BOOL WIN32API SendMessageCallbackA(HWND          hWnd,
-                                   UINT          uMsg,
-                                   WPARAM        wParam,
-                                   LPARAM        lParam,
-                                   SENDASYNCPROC lpResultCallBack,
-                                   DWORD         dwData)
-{
-  dprintf(("USER32:SendMessageCallBackA (%08xh,%08xh,%08xh,%08xh,%08xh,%08x) not implemented.\n",
-         hWnd,
-         uMsg,
-         wParam,
-         lParam,
-         lpResultCallBack,
-         dwData));
-
-  return (FALSE);
-}
-
-
-/*****************************************************************************
- * Name      : BOOL WIN32API SendMessageCallbackW
- * Purpose   : The SendMessageCallback function sends the specified message to
- *             a window or windows. The function calls the window procedure for
- *             the specified window and returns immediately. After the window
- *             procedure processes the message, the system calls the specified
- *             callback function, passing the result of the message processing
- *             and an application-defined value to the callback function.
- * Parameters: HWND  hwnd                      handle of destination window
- *             UINT  uMsg                      message to send
- *             WPARAM  wParam                  first message parameter
- *             LPARAM  lParam                  second message parameter
- *             SENDASYNCPROC  lpResultCallBack function to receive message value
- *             DWORD  dwData                   value to pass to callback function
- * Variables :
- * Result    : If the function succeeds, the return value is TRUE.
- *             If the function fails, the return value is FALSE. To get extended
- *             error information, call GetLastError.
- * Remark    :
- * Status    : UNTESTED STUB
- *
- * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
- *****************************************************************************/
-
-BOOL WIN32API SendMessageCallbackW(HWND          hWnd,
-                                      UINT          uMsg,
-                                      WPARAM        wParam,
-                                      LPARAM        lParam,
-                                      SENDASYNCPROC lpResultCallBack,
-                                      DWORD         dwData)
-{
-  dprintf(("USER32:SendMessageCallBackW (%08xh,%08xh,%08xh,%08xh,%08xh,%08x) not implemented.\n",
-         hWnd,
-         uMsg,
-         wParam,
-         lParam,
-         lpResultCallBack,
-         dwData));
-
-  return (FALSE);
-}
-/*****************************************************************************
- * Name      : long WIN32API BroadcastSystemMessage
- * Purpose   : The BroadcastSystemMessage function sends a message to the given
- *             recipients. The recipients can be applications, installable
- *             drivers, Windows-based network drivers, system-level device
- *             drivers, or any combination of these system components.
- * Parameters: DWORD   dwFlags,
-               LPDWORD lpdwRecipients,
-               UINT    uiMessage,
-               WPARAM  wParam,
-               LPARAM  lParam
- * Variables :
- * Result    : If the function succeeds, the return value is a positive value.
- *             If the function is unable to broadcast the message, the return value is -1.
- *             If the dwFlags parameter is BSF_QUERY and at least one recipient returned FALSE to the corresponding message, the return value is zero.
- * Remark    :
- * Status    : UNTESTED STUB
- *
- * Author    : Patrick Haller [Thu, 1998/02/26 11:55]
- *****************************************************************************/
-
-long WIN32API BroadcastSystemMessage(DWORD   dwFlags,
-                                        LPDWORD lpdwRecipients,
-                                        UINT    uiMessage,
-                                        WPARAM  wParam,
-                                        LPARAM  lParam)
-{
-  dprintf(("USER32:BroadcastSystemMessage(%08xh,%08xh,%08xh,%08xh,%08x) not implemented.\n",
-        dwFlags,
-        lpdwRecipients,
-        uiMessage,
-        wParam,
-        lParam));
-
-  return (-1);
 }
 //******************************************************************************
