I`m opening an edit box ina window, Works fine. But when i`m trying to subclass, windowsXP kicks me out.
Maybe it is obvious, I can`t see what`s wrong
Here:
...
  .if uMsg == WM_COMMAND ;sends parent window
          .if wParam == sEdit      ; is it my msg?
            invoke CreateWindowEx,WS_EX_LEFT, ADDR EditClassName,NULL,\
                            WS_CHILD  or ES_MULTILINE or ES_LEFT or\
                                  ES_AUTOHSCROLL or WS_HSCROLL or WS_VSCROLL,5,5,485,185,\
                                  hWin,EditID,hInstance,NULL    ;ez ?redekes hWin...
      mov  hEdit,eax
            lea eax,EditWndProc
            invoke dwtoa,eax,ADDR buffer3
            invoke MessageBox,NULL,ADDR buffer3,SADD("subclassedit,hEdit"),MB_OK
invoke SetWindowLong,hEdit,GWL_WNDPROC,addr EditWndProc
      invoke ShowWindow,hEdit,SW_SHOWNORMAL
    invoke SetFocus, hEdit
mov OldWndProc,eax
          .endif ;
  .endif
***
EditWndProc PROC hEdit21:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD
  invoke CallWindowProc,OldWndProc,hEdit21,uMsg,wParam,lParam
  ret
EditWndProc endp

Posted on 2005-06-13 15:50:43 by ola_dina

invoke SetWindowLong,hEdit,GWL_WNDPROC,addr EditWndProc
invoke ShowWindow,hEdit,SW_SHOWNORMAL
invoke SetFocus, hEdit
mov OldWndProc,eax


By the time you do "mov OldWndProc,eax", EAX has already been overwritten repeatedly. You should save the return value from SetWindowLong immediately -- that is, before calling ShowWindow and SetFocus.
Posted on 2005-06-13 16:27:26 by Frank
oh my god...
Posted on 2005-06-13 17:26:38 by ola_dina