Ignore:
Timestamp:
Feb 5, 2002, 6:59:31 PM (24 years ago)
Author:
sandervl
Message:

message handling changes

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/win32wbase.cpp

    r7780 r7801  
    1 /* $Id: win32wbase.cpp,v 1.312 2002-01-20 15:26:21 sandervl Exp $ */
     1/* $Id: win32wbase.cpp,v 1.313 2002-02-05 17:59:00 sandervl Exp $ */
    22/*
    33 * Win32 Window Base Class for OS/2
     
    169169  fIsModalDialogOwner = FALSE;
    170170  OS2HwndModalDialog  = 0;
    171   fInternalMsg     = FALSE;
    172171  fParentChange    = FALSE;
    173172  fDestroyWindowCalled = FALSE;
     
    212211  hotkey           = 0;
    213212
    214 
    215213  hwndLinkAfter    = HWND_BOTTOM;
    216214  flags            = 0;
    217   lastHitTestVal   = HTOS_NORMAL;
     215  lastHitTestVal   = HTCLIENT;
    218216  owner            = NULL;
    219217  windowClass      = 0;
     
    846844            if(!(flags & WIN_NEED_SIZE))
    847845            {
    848                 SendInternalMessageA(WM_SIZE, SIZE_RESTORED,
    849                                 MAKELONG(rectClient.right-rectClient.left,
    850                                          rectClient.bottom-rectClient.top));
     846                SendMessageA(getWindowHandle(), WM_SIZE, SIZE_RESTORED,
     847                             MAKELONG(rectClient.right-rectClient.left,
     848                             rectClient.bottom-rectClient.top));
    851849
    852850                if(!::IsWindow(hwnd))
     
    855853                    goto end;
    856854                }
    857                 SendInternalMessageA(WM_MOVE,0,MAKELONG(rectClient.left,rectClient.top));
     855                SendMessageA(getWindowHandle(), WM_MOVE,0,MAKELONG(rectClient.left,rectClient.top));
    858856                if(!::IsWindow(hwnd))
    859857                {
     
    883881                if(getParent() && getParent()->IsWindowDestroyed() == FALSE)
    884882                {
    885                     getParent()->SendInternalMessageA(WM_PARENTNOTIFY, MAKEWPARAM(WM_CREATE, getWindowId()), (LPARAM)getWindowHandle());
     883                    SendMessageA(getParent()->getWindowHandle(), WM_PARENTNOTIFY, MAKEWPARAM(WM_CREATE, getWindowId()), (LPARAM)getWindowHandle());
    886884                }
    887885                if(!::IsWindow(hwnd))
     
    914912ULONG Win32BaseWindow::MsgQuit()
    915913{
    916   return SendInternalMessageA(WM_QUIT, 0, 0);
     914  return SendMessageA(getWindowHandle(), WM_QUIT, 0, 0);
    917915}
    918916//******************************************************************************
     
    920918ULONG Win32BaseWindow::MsgClose()
    921919{
    922   return SendInternalMessageA(WM_CLOSE,0,0);
     920  return SendMessageA(getWindowHandle(), WM_CLOSE,0,0);
    923921}
    924922//******************************************************************************
     
    940938            {
    941939                    /* Notify the parent window only */
    942                     getParent()->SendMessageA(WM_PARENTNOTIFY, MAKEWPARAM(WM_DESTROY, getWindowId()), (LPARAM)getWindowHandle());
     940                    SendMessageA(getParent()->getWindowHandle(), WM_PARENTNOTIFY, MAKEWPARAM(WM_DESTROY, getWindowId()), (LPARAM)getWindowHandle());
    943941            }
    944942////            else    DebugInt3();
    945943        }
    946944    }
    947     SendInternalMessageA(WM_DESTROY, 0, 0);
     945    SendMessageA(getWindowHandle(),WM_DESTROY, 0, 0);
    948946    if(::IsWindow(hwnd) == FALSE) {
    949947        //object already destroyed, so return immediately
    950948        return 1;
    951949    }
    952     SendInternalMessageA(WM_NCDESTROY, 0, 0);
     950    SendMessageA(getWindowHandle(),WM_NCDESTROY, 0, 0);
    953951
    954952    TIMER_KillTimerFromWindow(getWindowHandle());
     
    979977    else dwStyle |= WS_DISABLED;
    980978
    981     return SendInternalMessageA(WM_ENABLE, fEnable, 0);
     979    return SendMessageA(getWindowHandle(),WM_ENABLE, fEnable, 0);
    982980}
    983981//******************************************************************************
     
    999997
    1000998    //already sent from ShowWindow
    1001 ////    return SendInternalMessageA(WM_SHOWWINDOW, fShow, 0);
     999////    return SendMessageA(getWindowHandle(),WM_SHOWWINDOW, fShow, 0);
    10021000    return 0;
    10031001}
     
    10111009        return 0;
    10121010
    1013     return SendInternalMessageA(WM_WINDOWPOSCHANGING, 0, lp);
     1011    return SendMessageA(getWindowHandle(),WM_WINDOWPOSCHANGING, 0, lp);
    10141012}
    10151013//******************************************************************************
     
    10221020        return 1;
    10231021
    1024     return SendInternalMessageA(WM_WINDOWPOSCHANGED, 0, lp);
     1022    return SendMessageA(getWindowHandle(),WM_WINDOWPOSCHANGED, 0, lp);
    10251023}
    10261024//******************************************************************************
     
    10301028  //According to the SDK docs, the scrollbar handle (lParam) is 0 when the standard
    10311029  //window scrollbars send these messages
    1032   return SendInternalMessageA(msg, MAKELONG(scrollCode, scrollPos), 0);
     1030  return SendMessageA(getWindowHandle(),msg, MAKELONG(scrollCode, scrollPos), 0);
    10331031}
    10341032//******************************************************************************
     
    10461044    //default processing is cancelled
    10471045    //TODO: According to Wine we should proceed anyway if window is sysmodal
    1048     if(SendInternalMessageA(WM_NCACTIVATE, fActivate, 0) == FALSE && !fActivate)
     1046    if(SendMessageA(getWindowHandle(),WM_NCACTIVATE, fActivate, 0) == FALSE && !fActivate)
    10491047    {
    10501048        dprintf(("WARNING: WM_NCACTIVATE return code = FALSE -> cancel processing"));
     
    10551053    {
    10561054        if(fActivate) {//WM_CHILDACTIVE is for activation only
    1057             SendInternalMessageA(WM_CHILDACTIVATE, 0, 0L);
     1055            SendMessageA(getWindowHandle(),WM_CHILDACTIVATE, 0, 0L);
    10581056        }
    10591057        return 0;
    10601058    }
    10611059
    1062     return SendInternalMessageA(WM_ACTIVATE, MAKELONG((fActivate) ? WA_ACTIVE : WA_INACTIVE, fMinimized), hwnd);
     1060    return SendMessageA(getWindowHandle(),WM_ACTIVATE, MAKELONG((fActivate) ? WA_ACTIVE : WA_INACTIVE, fMinimized), hwnd);
    10631061}
    10641062//******************************************************************************
     
    10741072    //default processing is cancelled
    10751073    //TODO: According to Wine we should proceed anyway if window is sysmodal
    1076     if(SendInternalMessageA(WM_NCACTIVATE, fActivate, 0) == FALSE && !fActivate)
     1074    if(SendMessageA(getWindowHandle(),WM_NCACTIVATE, fActivate, 0) == FALSE && !fActivate)
    10771075    {
    10781076        dprintf(("WARNING: WM_NCACTIVATE return code = FALSE -> cancel processing"));
     
    10831081    {
    10841082        if(fActivate) {//WM_CHILDACTIVE is for activation only
    1085             SendInternalMessageA(WM_CHILDACTIVATE, 0, 0L);
     1083            SendMessageA(getWindowHandle(),WM_CHILDACTIVATE, 0, 0L);
    10861084        }
    10871085        return 0;
     
    10941092ULONG Win32BaseWindow::DispatchMsgA(MSG *msg)
    10951093{
    1096     return SendInternalMessageA(msg->message, msg->wParam, msg->lParam);
     1094    return SendMessageA(getWindowHandle(),msg->message, msg->wParam, msg->lParam);
    10971095}
    10981096//******************************************************************************
     
    11001098ULONG Win32BaseWindow::DispatchMsgW(MSG *msg)
    11011099{
    1102     return SendInternalMessageW(msg->message, msg->wParam, msg->lParam);
     1100    return SendMessageW(getWindowHandle(), msg->message, msg->wParam, msg->lParam);
    11031101}
    11041102//******************************************************************************
     
    11111109    }
    11121110
    1113     return  SendInternalMessageA(WM_SETFOCUS, hwnd, 0);
     1111    return SendMessageA(getWindowHandle(),WM_SETFOCUS, hwnd, 0);
    11141112}
    11151113//******************************************************************************
     
    11211119        return 0;
    11221120    }
    1123     return  SendInternalMessageA(WM_KILLFOCUS, hwnd, 0);
     1121    return  SendMessageA(getWindowHandle(),WM_KILLFOCUS, hwnd, 0);
    11241122}
    11251123//******************************************************************************
     
    11301128
    11311129    dprintf(("MsgButton %d at (%d,%d)", msg->message, msg->pt.x, msg->pt.y));
    1132     switch(msg->message) {
     1130    switch(msg->message)
     1131    {
    11331132        case WM_LBUTTONDBLCLK:
    11341133        case WM_RBUTTONDBLCLK:
     
    11671166        if (hwndTop && (getWindowHandle() != hwndActive))
    11681167        {
    1169                 LONG ret = SendInternalMessageA(WM_MOUSEACTIVATE, hwndTop,
    1170                                                 MAKELONG( lastHitTestVal, msg->message) );
     1168                LONG ret = SendMessageA(getWindowHandle(),WM_MOUSEACTIVATE, hwndTop,
     1169                                        MAKELONG( lastHitTestVal, msg->message) );
    11711170
    11721171                dprintf2(("WM_MOUSEACTIVATE returned %d", ret));
     
    11921191    }
    11931192
    1194     SendInternalMessageA(WM_SETCURSOR, getWindowHandle(), MAKELONG(lastHitTestVal, msg->message));
    1195 
    1196     return  SendInternalMessageA(msg->message, msg->wParam, msg->lParam);
     1193    SendMessageA(getWindowHandle(),WM_SETCURSOR, getWindowHandle(), MAKELONG(lastHitTestVal, msg->message));
     1194
     1195    switch(msg->message)
     1196    {
     1197        case WM_LBUTTONDOWN:
     1198        case WM_MBUTTONDOWN:
     1199        case WM_RBUTTONDOWN:
     1200        {
     1201                if (getParent())
     1202                {
     1203                    POINTS pt = MAKEPOINTS(msg->lParam);
     1204                    POINT point;
     1205
     1206                    point.x = pt.x;
     1207                    point.y = pt.y;
     1208                    MapWindowPoints(getWindowHandle(), getParent()->getWindowHandle(), &point, 1);
     1209                    NotifyParent(msg->message, msg->wParam, MAKELPARAM(point.x,point.y));
     1210                }
     1211                break;
     1212        }
     1213    }
     1214    return SendMessageA(getWindowHandle(),msg->message, msg->wParam, msg->lParam);
    11971215}
    11981216//******************************************************************************
     
    12011219{
    12021220    if (select && IsWindowIconic())
    1203         return SendInternalMessageA(WM_PAINTICON, 1, 0);
     1221        return SendMessageA(getWindowHandle(),WM_PAINTICON, 1, 0);
    12041222    else
    1205         return SendInternalMessageA(WM_PAINT, 0, 0);
     1223        return SendMessageA(getWindowHandle(),WM_PAINT, 0, 0);
    12061224}
    12071225//******************************************************************************
     
    12181236
    12191237    if(IsWindowIconic())
    1220         rc = SendInternalMessageA(WM_ICONERASEBKGND, hdcErase, 0);
     1238        rc = SendMessageA(getWindowHandle(),WM_ICONERASEBKGND, hdcErase, 0);
    12211239    else
    1222         rc = SendInternalMessageA(WM_ERASEBKGND, hdcErase, 0);
     1240        rc = SendMessageA(getWindowHandle(),WM_ERASEBKGND, hdcErase, 0);
    12231241    if (hdc == 0)
    12241242        ReleaseDC(getWindowHandle(), hdcErase);
     
    12321250    //SDK: WM_SETCURSOR is not sent if the mouse is captured
    12331251    if(GetCapture() == 0) {
    1234         SendInternalMessageA(WM_SETCURSOR, Win32Hwnd, MAKELONG(lastHitTestVal, msg->message));
     1252        SendMessageA(getWindowHandle(),WM_SETCURSOR, Win32Hwnd, MAKELONG(lastHitTestVal, msg->message));
    12351253    }
    12361254
    12371255    //translated message == WM_(NC)MOUSEMOVE
    1238     return SendInternalMessageA(msg->message, msg->wParam, msg->lParam);
     1256    return SendMessageA(getWindowHandle(),msg->message, msg->wParam, msg->lParam);
    12391257}
    12401258//******************************************************************************
     
    12641282    hrgn = CreateRectRgnIndirect(pUpdateRect);
    12651283
    1266     rc = SendInternalMessageA(WM_NCPAINT, hrgn, 0);
     1284    rc = SendMessageA(getWindowHandle(),WM_NCPAINT, hrgn, 0);
    12671285
    12681286    DeleteObject(hrgn);
     
    13551373ULONG Win32BaseWindow::MsgSetText(LPSTR lpsz, LONG cch)
    13561374{
    1357     return SendInternalMessageA(WM_SETTEXT, 0, (LPARAM)lpsz);
     1375    return SendMessageA(getWindowHandle(),WM_SETTEXT, 0, (LPARAM)lpsz);
    13581376}
    13591377//******************************************************************************
     
    13611379ULONG Win32BaseWindow::MsgGetTextLength()
    13621380{
    1363     return SendInternalMessageA(WM_GETTEXTLENGTH, 0, 0);
     1381    return SendMessageA(getWindowHandle(),WM_GETTEXTLENGTH, 0, 0);
    13641382}
    13651383//******************************************************************************
     
    13671385void Win32BaseWindow::MsgGetText(char *wndtext, ULONG textlength)
    13681386{
    1369     SendInternalMessageA(WM_GETTEXT, textlength, (LPARAM)wndtext);
     1387    SendMessageA(getWindowHandle(),WM_GETTEXT, textlength, (LPARAM)wndtext);
    13701388}
    13711389//******************************************************************************
     
    15081526   */
    15091527  if ( uFlags & PRF_ERASEBKGND)
    1510     SendInternalMessageA(WM_ERASEBKGND, (WPARAM)hdc, 0);
     1528    SendMessageA(getWindowHandle(),WM_ERASEBKGND, (WPARAM)hdc, 0);
    15111529
    15121530  /*
     
    15141532   */
    15151533  if ( uFlags & PRF_CLIENT)
    1516     SendInternalMessageA(WM_PRINTCLIENT, (WPARAM)hdc, PRF_CLIENT);
     1534    SendMessageA(getWindowHandle(),WM_PRINTCLIENT, (WPARAM)hdc, PRF_CLIENT);
    15171535
    15181536
     
    16441662        {
    16451663            if(getParent()) {
    1646                 LRESULT rc = getParent()->SendInternalMessageA(WM_MOUSEACTIVATE, wParam, lParam );
     1664                LRESULT rc = SendMessageA(getParent()->getWindowHandle(), WM_MOUSEACTIVATE, wParam, lParam );
    16471665                if(rc)  return rc;
    16481666            }
     
    16661684        {
    16671685            if(getParent()) {
    1668                 LRESULT rc = getParent()->SendInternalMessageA(WM_SETCURSOR, wParam, lParam);
     1686                LRESULT rc = SendMessageA(getParent()->getWindowHandle(), WM_SETCURSOR, wParam, lParam);
    16691687                if(rc)  return rc;
    16701688            }
     
    17251743        if (!(wpos->flags & SWP_NOMOVE) && !(wpos->flags & SWP_NOCLIENTMOVE))
    17261744        {
    1727             SendInternalMessageA(WM_MOVE, 0, MAKELONG(rectClient.left,rectClient.top));
     1745            SendMessageA(getWindowHandle(),WM_MOVE, 0, MAKELONG(rectClient.left,rectClient.top));
    17281746        }
    17291747        if (!(wpos->flags & SWP_NOSIZE) && !(wpos->flags & SWP_NOCLIENTSIZE))
     
    17331751            if (dwStyle & WS_MINIMIZE) wp = SIZE_MINIMIZED;
    17341752
    1735             SendInternalMessageA(WM_SIZE, wp, MAKELONG(rectClient.right  - rectClient.left,
     1753            SendMessageA(getWindowHandle(),WM_SIZE, wp, MAKELONG(rectClient.right  - rectClient.left,
    17361754                                                       rectClient.bottom - rectClient.top));
    17371755        }
     
    18721890             else
    18731891                if( wParam == VK_ESCAPE && (GetKeyState(VK_SHIFT) & 0x8000))
    1874                     SendMessageW(WM_SYSCOMMAND, SC_KEYMENU, VK_SPACE );
     1892                    SendMessageW(getWindowHandle(), WM_SYSCOMMAND, SC_KEYMENU, VK_SPACE );
    18751893
    18761894        Win32BaseWindow *siblingWindow;
     
    19041922            // key matches siblings mnemonic, send mouseclick
    19051923            if (mnemonic == (char) wParam) {
    1906                 siblingWindow->SendInternalMessageA (BM_CLICK, 0, 0);
     1924                ::SendMessageA(siblingWindow->getWindowHandle(), BM_CLICK, 0, 0);
    19071925            }
    19081926            sibling = siblingWindow->GetNextWindow (GW_HWNDNEXT);
     
    19381956                        ::SendMessageW(GetParent(), Msg, wParam, lParam );
    19391957                }
    1940                 else    SendMessageA(WM_SYSCOMMAND, (WPARAM)SC_KEYMENU, (LPARAM)(DWORD)wParam );
     1958                else    ::SendMessageA(getWindowHandle(), WM_SYSCOMMAND, (WPARAM)SC_KEYMENU, (LPARAM)(DWORD)wParam );
    19411959        }
    19421960#if 0
     
    19561974    case WM_CONTEXTMENU:
    19571975        if ((dwStyle & WS_CHILD) && getParent())
    1958           getParent()->SendInternalMessageA(WM_CONTEXTMENU,wParam,lParam);
     1976          SendMessageA(getParent()->getWindowHandle(), WM_CONTEXTMENU,wParam,lParam);
    19591977        return 0;
    19601978
     
    20292047
    20302048    case WM_HELP:
    2031         if (getParent()) getParent()->SendInternalMessageA(Msg,wParam,lParam);
     2049        if (getParent()) SendMessageA(getParent()->getWindowHandle(), Msg,wParam,lParam);
    20322050        break;
    20332051
     
    21212139//******************************************************************************
    21222140//******************************************************************************
    2123 LRESULT Win32BaseWindow::SendMessageA(ULONG Msg, WPARAM wParam, LPARAM lParam)
    2124 {
    2125     //if the destination window is created by this process & thread, call window proc directly
    2126     if(dwProcessId == currentProcessId && dwThreadId == GetCurrentThreadId()) {
    2127         return SendInternalMessageA(Msg, wParam, lParam);
    2128     }
    2129     //otherwise use WinSendMsg to send it to the right process/thread
    2130     dprintf(("SendMessages (inter-process) %x %x %x %x", getWindowHandle(), Msg, wParam, lParam));
    2131     return OSLibSendMessage(getOS2WindowHandle(), Msg, wParam, lParam, FALSE);
    2132 }
    2133 //******************************************************************************
    2134 //******************************************************************************
    2135 LRESULT Win32BaseWindow::SendMessageW(ULONG Msg, WPARAM wParam, LPARAM lParam)
    2136 {
    2137     //if the destination window is created by this process & thread, call window proc directly
    2138     if(dwProcessId == currentProcessId && dwThreadId == GetCurrentThreadId()) {
    2139         return SendInternalMessageW(Msg, wParam, lParam);
    2140     }
    2141     //otherwise use WinSendMsg to send it to the right process/thread
    2142     return OSLibSendMessage(getOS2WindowHandle(), Msg, wParam, lParam, TRUE);
    2143 }
    2144 //******************************************************************************
    2145 //Called as a result of an OS/2 message or called from a class method
    2146 //******************************************************************************
    2147 LRESULT Win32BaseWindow::SendInternalMessageA(ULONG Msg, WPARAM wParam, LPARAM lParam)
    2148 {
    2149  LRESULT rc;
    2150  HWND    hwnd = getWindowHandle();
    2151  BOOL    fInternalMsgBackup = fInternalMsg;
    2152 
    2153   //if the destination window was created by this process & thread, call window proc directly
    2154   if(dwProcessId != currentProcessId || dwThreadId != GetCurrentThreadId()) {
    2155         dprintf(("SendMessages (inter-process) %x %x %x %x", getWindowHandle(), Msg, wParam, lParam));
    2156         return OSLibSendMessage(getOS2WindowHandle(), Msg, wParam, lParam, FALSE);
    2157   }
    2158 
    2159   DebugPrintMessage(getWindowHandle(), Msg, wParam, lParam, FALSE, TRUE);
    2160 
    2161   CallWindowHookProc(WH_CALLWNDPROC, Msg, wParam, lParam, FALSE);
    2162 
    2163   fInternalMsg = TRUE;
    2164   switch(Msg)
    2165   {
    2166         case WM_CREATE:
    2167         {
    2168                 if(CallWindowProcA(win32wndproc, getWindowHandle(), WM_CREATE, 0, lParam) == -1) {
    2169                         dprintf(("WM_CREATE returned -1\n"));
    2170                         rc = -1; //don't create window
    2171                         break;
    2172                 }
    2173                 rc = 0;
    2174                 break;
    2175         }
    2176         case WM_LBUTTONDOWN:
    2177         case WM_MBUTTONDOWN:
    2178         case WM_RBUTTONDOWN:
    2179         {
    2180                 if (getParent())
    2181                 {
    2182                     POINTS pt = MAKEPOINTS(lParam);
    2183                     POINT point;
    2184 
    2185                     point.x = pt.x;
    2186                     point.y = pt.y;
    2187                     MapWindowPoints(getWindowHandle(), getParent()->getWindowHandle(), &point, 1);
    2188                     NotifyParent(Msg,wParam,MAKELPARAM(point.x,point.y));
    2189                 }
    2190                 rc = win32wndproc(getWindowHandle(), Msg, wParam, lParam);
    2191                 break;
    2192         }
    2193         case WM_NCHITTEST:
    2194                 rc = lastHitTestVal = win32wndproc(getWindowHandle(), WM_NCHITTEST, wParam, lParam);
    2195                 break;
    2196 
    2197         case WM_DESTROY:
    2198                 rc = win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0);
    2199                 break;
    2200 
    2201         default:
    2202                 rc = CallWindowProcA(win32wndproc, getWindowHandle(), Msg, wParam, lParam);
    2203                 break;
    2204   }
    2205   if(!::IsWindow(hwnd)) {
    2206         //window might have been destroyed by now. (this pointer invalid)
    2207         //we must return immediately
    2208         //(MS Visual C++ install heap corruption)
    2209         //TODO: could happen in several places here!!!!
    2210         return rc;
    2211   }
    2212   fInternalMsg = fInternalMsgBackup;
    2213   dprintf2(("SendMessageA %x %x %x %x returned %x", getWindowHandle(), Msg, wParam, lParam, rc));
    2214   return rc;
    2215 }
    2216 //******************************************************************************
    2217 //Called as a result of an OS/2 message or called from a class method
    2218 //******************************************************************************
    2219 LRESULT Win32BaseWindow::SendInternalMessageW(ULONG Msg, WPARAM wParam, LPARAM lParam)
    2220 {
    2221  LRESULT rc;
    2222  HWND    hwnd = getWindowHandle();
    2223  BOOL    fInternalMsgBackup = fInternalMsg;
    2224 
    2225   //if the destination window was created by this process & thread, call window proc directly
    2226   if(dwProcessId != currentProcessId || dwThreadId != GetCurrentThreadId()) {
    2227         dprintf(("SendMessages (inter-process) %x %x %x %x", getWindowHandle(), Msg, wParam, lParam));
    2228         return OSLibSendMessage(getOS2WindowHandle(), Msg, wParam, lParam, FALSE);
    2229   }
    2230 
    2231   DebugPrintMessage(getWindowHandle(), Msg, wParam, lParam, TRUE, TRUE);
    2232 
    2233   CallWindowHookProc(WH_CALLWNDPROC, Msg, wParam, lParam, TRUE);
    2234 
    2235   fInternalMsg = TRUE;
    2236   switch(Msg)
    2237   {
    2238         case WM_CREATE:
    2239         {
    2240                 if(CallWindowProcW(win32wndproc, getWindowHandle(), WM_CREATE, 0, lParam) == -1) {
    2241                         dprintf(("WM_CREATE returned -1\n"));
    2242                         rc = -1; //don't create window
    2243                         break;
    2244                 }
    2245                 rc = 0;
    2246                 break;
    2247         }
    2248         case WM_LBUTTONDOWN:
    2249         case WM_MBUTTONDOWN:
    2250         case WM_RBUTTONDOWN:
    2251                 NotifyParent(Msg, wParam, lParam);
    2252                 rc = win32wndproc(getWindowHandle(), Msg, wParam, lParam);
    2253                 break;
    2254 
    2255         case WM_NCHITTEST:
    2256                 rc = lastHitTestVal = win32wndproc(getWindowHandle(), WM_NCHITTEST, wParam, lParam);
    2257                 break;
    2258 
    2259         case WM_DESTROY:
    2260                 rc = win32wndproc(getWindowHandle(), WM_DESTROY, 0, 0);
    2261                 break;
    2262         default:
    2263                 rc = CallWindowProcW(win32wndproc, getWindowHandle(), Msg, wParam, lParam);
    2264                 break;
    2265   }
    2266   if(!::IsWindow(hwnd)) {
    2267         //window might have been destroyed by now. (this pointer invalid)
    2268         //we must return immediately
    2269         //(MS Visual C++ install heap corruption)
    2270         //TODO: could happen in several places here!!!!
    2271         return rc;
    2272   }
    2273   fInternalMsg = fInternalMsgBackup;
    2274   dprintf2(("SendMessageW %x %x %x %x returned %x", getWindowHandle(), Msg, wParam, lParam, rc));
    2275   return rc;
    2276 }
    2277 //******************************************************************************
    2278 //******************************************************************************
    2279 void Win32BaseWindow::CallWindowHookProc(ULONG hooktype, ULONG Msg, WPARAM wParam, LPARAM lParam, BOOL fUnicode)
    2280 {
    2281  CWPSTRUCT cwp;
    2282 
    2283     cwp.lParam  = lParam;
    2284     cwp.wParam  = wParam;
    2285     cwp.message = Msg;
    2286     cwp.hwnd    = getWindowHandle();
    2287 
    2288     switch(hooktype) {
    2289     case WH_CALLWNDPROC:
    2290         if(fUnicode) {
    2291              HOOK_CallHooksW(WH_CALLWNDPROC, HC_ACTION, 1, (LPARAM)&cwp);
    2292         }
    2293         else HOOK_CallHooksA(WH_CALLWNDPROC, HC_ACTION, 1, (LPARAM)&cwp);
    2294         break;
    2295     }
    2296 }
    2297 //******************************************************************************
    2298 //TODO: Do this more efficiently
    2299 //******************************************************************************
    2300 LRESULT Win32BaseWindow::BroadcastMessageA(int type, UINT msg, WPARAM wParam, LPARAM lParam)
    2301 {
    2302  Win32BaseWindow *window;
    2303  HWND hwnd = WNDHANDLE_MAGIC_HIGHWORD;
    2304 
    2305     dprintf(("BroadCastMessageA %x %x %x %s", msg, wParam, lParam, (type == BROADCAST_SEND) ? "Send" : "Post"));
    2306 
    2307     for(int i=0;i<MAX_WINDOW_HANDLES;i++) {
    2308         window = GetWindowFromHandle(hwnd++);
    2309         if(window) {
    2310             if ((window->getStyle() & WS_POPUP) || ((window->getStyle() & WS_CAPTION) == WS_CAPTION))
    2311             {
    2312                 if(type == BROADCAST_SEND) {
    2313                         ::SendMessageA(window->getWindowHandle(), msg, wParam, lParam);
    2314                 }
    2315                 else    PostMessageA(window->getWindowHandle(), msg, wParam, lParam);
    2316             }
    2317             RELEASE_WNDOBJ(window);
    2318         }
    2319     }
    2320     return 0;
    2321 }
    2322 //******************************************************************************
    2323 //TODO: Do this more efficiently
    2324 //******************************************************************************
    2325 LRESULT Win32BaseWindow::BroadcastMessageW(int type, UINT msg, WPARAM wParam, LPARAM lParam)
    2326 {
    2327  Win32BaseWindow *window;
    2328  HWND hwnd = WNDHANDLE_MAGIC_HIGHWORD;
    2329 
    2330     dprintf(("BroadCastMessageW %x %x %x %s", msg, wParam, lParam, (type == BROADCAST_SEND) ? "Send" : "Post"));
    2331 
    2332     for(int i=0;i<MAX_WINDOW_HANDLES;i++) {
    2333         window = GetWindowFromHandle(hwnd++);
    2334         if(window) {
    2335             if ((window->getStyle() & WS_POPUP) || ((window->getStyle() & WS_CAPTION) == WS_CAPTION))
    2336             {
    2337                 if(type == BROADCAST_SEND) {
    2338                         ::SendMessageW(window->getWindowHandle(), msg, wParam, lParam);
    2339                 }
    2340                 else    PostMessageW(window->getWindowHandle(), msg, wParam, lParam);
    2341             }
    2342             RELEASE_WNDOBJ(window);
    2343         }
    2344     }
    2345     return 0;
    2346 }
    2347 //******************************************************************************
    2348 //******************************************************************************
    23492141void Win32BaseWindow::NotifyParent(UINT Msg, WPARAM wParam, LPARAM lParam)
    23502142{
     
    23592151                parentwindow = window->getParent();
    23602152                if(parentwindow) {
    2361                         parentwindow->SendInternalMessageA(WM_PARENTNOTIFY, MAKEWPARAM(Msg, getWindowId()), lParam );
     2153                    SendMessageA(parentwindow->getWindowHandle(), WM_PARENTNOTIFY, MAKEWPARAM(Msg, getWindowId()), lParam );
    23622154                }
    23632155        }
     
    24912283    if (showFlag != wasVisible)
    24922284    {
    2493         SendInternalMessageA(WM_SHOWWINDOW, showFlag, 0 );
     2285        SendMessageA(getWindowHandle(),WM_SHOWWINDOW, showFlag, 0 );
    24942286        if (!::IsWindow( getWindowHandle() )) goto END;
    24952287    }
     
    25172309            wParam = SIZE_MINIMIZED;
    25182310
    2519         SendInternalMessageA(WM_SIZE, wParam,
     2311        SendMessageA(getWindowHandle(),WM_SIZE, wParam,
    25202312                     MAKELONG(rectClient.right-rectClient.left,
    25212313                              rectClient.bottom-rectClient.top));
    2522         SendInternalMessageA(WM_MOVE,0,MAKELONG(rectClient.left,rectClient.top));
     2314        SendMessageA(getWindowHandle(),WM_MOVE,0,MAKELONG(rectClient.left,rectClient.top));
    25232315    }
    25242316//testestest
     
    27212513    rectWindow.top    += dy;
    27222514    rectWindow.bottom += dy;
    2723     SendInternalMessageA(WM_MOVE, 0, MAKELONG(rectClient.left, rectClient.top));
     2515    SendMessageA(getWindowHandle(),WM_MOVE, 0, MAKELONG(rectClient.left, rectClient.top));
    27242516    return TRUE;
    27252517}
     
    27512543    WINDOWPOS wpOld = *wpos;
    27522544    if(!(wpos->flags & SWP_NOSENDCHANGING))
    2753         SendInternalMessageA(WM_WINDOWPOSCHANGING, 0, (LPARAM)wpos);
     2545        SendMessageA(getWindowHandle(),WM_WINDOWPOSCHANGING, 0, (LPARAM)wpos);
    27542546
    27552547    if ((wpos->hwndInsertAfter != wpOld.hwndInsertAfter) ||
     
    27592551         SetWindowPos(wpos->hwndInsertAfter, wpos->x, wpos->y, wpos->cx, wpos->cy, wpos->flags | SWP_NOSENDCHANGING);
    27602552    }
    2761     else SendInternalMessageA(WM_WINDOWPOSCHANGED, 0, (LPARAM)wpos);
     2553    else SendMessageA(getWindowHandle(),WM_WINDOWPOSCHANGED, 0, (LPARAM)wpos);
    27622554
    27632555    //Calculate invalid areas
     
    28822674        {
    28832675             /* Notify the parent window only */
    2884              getParent()->SendMessageA(WM_PARENTNOTIFY, MAKEWPARAM(WM_DESTROY, getWindowId()), (LPARAM)getWindowHandle());
     2676             SendMessageA(getParent()->getWindowHandle(), WM_PARENTNOTIFY, MAKEWPARAM(WM_DESTROY, getWindowId()), (LPARAM)getWindowHandle());
    28852677             if(!::IsWindow(hwnd) )
    28862678             {
     
    29062698    if (NULL != owner)
    29072699    {
    2908       if (owner->getLastActive() == hwnd)
    2909         owner->setLastActive( owner->getWindowHandle() );
     2700        if (owner->getLastActive() == hwnd)
     2701            owner->setLastActive( owner->getWindowHandle() );
    29102702    }
    29112703 
     
    30962888//******************************************************************************
    30972889//TODO: Should not enumerate children that are created during the enumeration!
     2890//TODO: Do this more efficiently
    30982891//******************************************************************************
    30992892BOOL Win32BaseWindow::EnumChildWindows(WNDENUMPROC lpfn, LPARAM lParam)
     
    31762969BOOL Win32BaseWindow::EnumWindows(WNDENUMPROC lpfn, LPARAM lParam)
    31772970{
    3178  Win32BaseWindow *child = 0;
    3179  BOOL   rc;
    3180  HWND   hwnd;
     2971 Win32BaseWindow *window;
     2972 BOOL             rc;
     2973 HWND             hwnd = WNDHANDLE_MAGIC_HIGHWORD;
    31812974
    31822975    dprintf(("EnumWindows %x %x", lpfn, lParam));
    31832976
    3184     for (child = (Win32BaseWindow *)getFirstChild(); child; child = (Win32BaseWindow *)child->getNextChild())
    3185     {
    3186         hwnd = child->getWindowHandle();
    3187 
    3188         dprintf2(("EnumWindows: Found Window %x", child->getWindowHandle()));
    3189         if((rc = lpfn(child->getWindowHandle(), lParam)) == FALSE) {
    3190             break;
    3191         }
    3192     }
     2977    for(int i=0;i<MAX_WINDOW_HANDLES;i++)
     2978    {
     2979        window = GetWindowFromHandle(hwnd++);
     2980        if(window)
     2981        {
     2982            if ((window->getStyle() & WS_POPUP) || ((window->getStyle() & WS_CAPTION) == WS_CAPTION))
     2983            {
     2984                dprintf2(("EnumWindows: Found Window %x", window->getWindowHandle()));
     2985                if((rc = lpfn(window->getWindowHandle(), lParam)) == FALSE) {
     2986                    break;
     2987                }
     2988            }
     2989            RELEASE_WNDOBJ(window);
     2990        }
     2991    }
     2992    if(window) RELEASE_WNDOBJ(window);
    31932993    return TRUE;
    31942994}
     
    35233323    rc = (getStyle() & WS_DISABLED) != 0;
    35243324    if(rc && !fEnable) {
    3525         SendMessageA(WM_CANCELMODE, 0, 0);
     3325        SendMessageA(getWindowHandle(), WM_CANCELMODE, 0, 0);
    35263326    }
    35273327    OSLibWinEnableWindow(OS2HwndFrame, fEnable);
     
    36243424{
    36253425    //if the destination window is created by this process, send message
    3626     if(dwProcessId == currentProcessId) {
     3426    if(dwProcessId == currentProcessId)
     3427    {
    36273428        if(fUnicode) {
    3628              return SendInternalMessageW(WM_GETTEXTLENGTH,0,0);
    3629         }
    3630         else return SendInternalMessageA(WM_GETTEXTLENGTH,0,0);
     3429             return SendMessageW(getWindowHandle(), WM_GETTEXTLENGTH,0,0);
     3430        }
     3431        else return SendMessageA(getWindowHandle(), WM_GETTEXTLENGTH,0,0);
    36313432    }
    36323433    //else get data directory from window structure
     
    36423443    //if the destination window is created by this process, send message
    36433444    if(dwProcessId == currentProcessId) {
    3644         return SendInternalMessageA(WM_GETTEXT,(WPARAM)cch,(LPARAM)lpsz);
     3445        return SendMessageA(getWindowHandle(),WM_GETTEXT,(WPARAM)cch,(LPARAM)lpsz);
    36453446    }
    36463447 
     
    36593460    //if the destination window is created by this process, send message
    36603461    if(dwProcessId == currentProcessId) {
    3661         return SendInternalMessageW(WM_GETTEXT,(WPARAM)cch,(LPARAM)lpsz);
     3462        return ::SendMessageW(getWindowHandle(), WM_GETTEXT,(WPARAM)cch,(LPARAM)lpsz);
    36623463    }
    36633464    //else get data directory from window structure
    3664   if (!lpsz || !cch)
    3665     return 0;
    3666   if (!windowNameW)
    3667     lpsz[0] = 0;
    3668   else
    3669     memcpy(lpsz, windowNameW, min( sizeof(WCHAR) * (windowNameLength+1), cch));
     3465    if (!lpsz || !cch)
     3466        return 0;
     3467    if (!windowNameW)
     3468        lpsz[0] = 0;
     3469    else
     3470        memcpy(lpsz, windowNameW, min( sizeof(WCHAR) * (windowNameLength+1), cch));
    36703471           
    3671   return min(windowNameLength, cch);
     3472    return min(windowNameLength, cch);
    36723473}
    36733474//******************************************************************************
     
    36763477BOOL Win32BaseWindow::SetWindowTextA(LPSTR lpsz)
    36773478{
    3678     return SendInternalMessageA(WM_SETTEXT,0,(LPARAM)lpsz);
     3479    return SendMessageA(getWindowHandle(),WM_SETTEXT,0,(LPARAM)lpsz);
    36793480}
    36803481//******************************************************************************
     
    36823483BOOL Win32BaseWindow::SetWindowTextW(LPWSTR lpsz)
    36833484{
    3684     return SendInternalMessageW(WM_SETTEXT,0,(LPARAM)lpsz);
     3485    return SendMessageW(getWindowHandle(), WM_SETTEXT,0,(LPARAM)lpsz);
    36853486}
    36863487//******************************************************************************
     
    37023503                ss.styleNew = value;
    37033504                dprintf(("SetWindowLong GWL_EXSTYLE %x old %x new style %x", getWindowHandle(), dwExStyle, value));
    3704                 SendInternalMessageA(WM_STYLECHANGING,GWL_EXSTYLE,(LPARAM)&ss);
     3505                SendMessageA(getWindowHandle(),WM_STYLECHANGING,GWL_EXSTYLE,(LPARAM)&ss);
    37053506                setExStyle(ss.styleNew);
    3706                 SendInternalMessageA(WM_STYLECHANGED,GWL_EXSTYLE,(LPARAM)&ss);
     3507                SendMessageA(getWindowHandle(),WM_STYLECHANGED,GWL_EXSTYLE,(LPARAM)&ss);
    37073508                oldval = ss.styleOld;
    37083509                break;
     
    37273528                ss.styleOld = getStyle();
    37283529                ss.styleNew = value | (ss.styleOld & WS_CHILD);
    3729                 SendInternalMessageA(WM_STYLECHANGING,GWL_STYLE,(LPARAM)&ss);
     3530                SendMessageA(getWindowHandle(),WM_STYLECHANGING,GWL_STYLE,(LPARAM)&ss);
    37303531                setStyle(ss.styleNew);
    3731                 SendInternalMessageA(WM_STYLECHANGED,GWL_STYLE,(LPARAM)&ss);
     3532                SendMessageA(getWindowHandle(),WM_STYLECHANGED,GWL_STYLE,(LPARAM)&ss);
    37323533                OSLibSetWindowStyle(getOS2FrameWindowHandle(), getOS2WindowHandle(), getStyle(), getExStyle());
    37333534
Note: See TracChangeset for help on using the changeset viewer.