Ignore:
Timestamp:
Jun 27, 1999, 11:59:40 PM (26 years ago)
Author:
sandervl
Message:

Dialog control proc override bugfix

File:
1 edited

Legend:

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

    r228 r232  
    1 /* $Id: setwindow.cpp,v 1.4 1999-06-27 17:01:46 sandervl Exp $ */
     1/* $Id: setwindow.cpp,v 1.5 1999-06-27 21:59:40 sandervl Exp $ */
    22
    33/*
     
    2323
    2424    dprintf(("USER32:  SetWindowLongA %X %d %X\n", hwnd, nIndex, arg3));
    25     if(nIndex == GWL_WNDPROC || nIndex == DWL_DLGPROC) {
     25    if(nIndex == GWL_WNDPROC || nIndex == DWL_DLGPROC)
     26    {
    2627        Win32WindowProc *wndproc = Win32WindowProc::FindProc(hwnd);
    27         if(wndproc == NULL) {//created with system class and app wants to change the handler
    28                 dprintf(("USER32:  ERROR: SetWindowLong new WindowProc for system class\n"));
    29                 //SvL: 26/06/99 Should no longer be possible
    30                 DebugInt3();
    31                 return(0);
     28        if(wndproc == NULL)
     29        {//dialog control that has was automatically created
     30                dprintf(("USER32:  SetWindowLong create new Win32 to OS/2 callback\n"));
     31                wndproc = new Win32WindowProc((WNDPROC)arg3, (WNDPROC_O32)O32_GetWindowLong(hwnd, nIndex));
     32                if(wndproc) {
     33                        O32_SetWindowLong(hwnd, nIndex, (LONG)wndproc->GetOS2Callback());
     34                        return (LONG)wndproc->GetWin32ToOS2Callback();
     35                }
     36                else    DebugInt3();
    3237        }
    3338        else {
    3439                if(!(nIndex == DWL_DLGPROC && wndproc->IsWindow() == TRUE)) {
    35                         rc = (LONG)wndproc->GetWin32Callback();
    36                         dprintf(("USER32:  SetWindowLong change WindowProc %X to %X\n", rc, arg3));
    37                         wndproc->SetWin32Callback((WNDPROC)arg3);
     40                        rc = (LONG)wndproc->GetWin32Callback();
     41                        if(rc == 0) {
     42                                //window proc that was just created with os/2 callback only
     43                                rc = (LONG) wndproc->GetWin32ToOS2Callback();
     44                        }
     45                        dprintf(("USER32:  SetWindowLong change WindowProc %X to %X\n", rc, arg3));
     46                        wndproc->SetWin32Callback((WNDPROC)arg3);
    3847                        O32_SetWindowLong(hwnd, nIndex, (LONG)wndproc->GetOS2Callback());
    39                         return(rc);
    40                 }
    41                 //else window that accesses it's normal window data
     48                        return(rc);
     49                }
    4250       }
    4351    }
     
    7482 LONG rc;
    7583
    76     dprintf(("USER32:  GetWindowLong %X %d\n", hwnd, nIndex));
     84    if(nIndex == GWL_WNDPROC || nIndex == DWL_DLGPROC)
     85    {
     86        dprintf(("USER32:  GetWindowLong %X %d\n", hwnd, nIndex));
    7787
    78     if(nIndex == GWL_WNDPROC || nIndex == DWL_DLGPROC) {
    79         Win32WindowProc *window = Win32WindowProc::FindProc(hwnd);
    80         if(window && !(nIndex == DWL_DLGPROC && window->IsWindow() == TRUE)) {
    81                 return (LONG)window->GetWin32Callback();
     88        Win32WindowProc *wndproc = Win32WindowProc::FindProc(hwnd);
     89        if(wndproc) {
     90                if(!(nIndex == DWL_DLGPROC && wndproc->IsWindow() == TRUE))
     91                        return (LONG)wndproc->GetWin32Callback();
    8292        }
     93        else {//probably a dialog box control
     94                dprintf(("USER32:  GetWindowLong create new Win32 to OS/2 callback\n"));
     95                wndproc = new Win32WindowProc(0, (WNDPROC_O32)O32_GetWindowLong(hwnd, nIndex));
     96                if(wndproc)
     97                        return (LONG)wndproc->GetWin32ToOS2Callback();
     98        }
    8399    }
    84100    rc = O32_GetWindowLong(hwnd, nIndex);
     
    87103    if(nIndex == GWL_ID && rc == 0xffff)
    88104        rc = 0xffffffff;
     105    dprintf(("USER32:  GetWindowLong %X %d returned %x\n", hwnd, nIndex, rc));
    89106    return(rc);
    90107}
Note: See TracChangeset for help on using the changeset viewer.