iin a window (not child) i`ve created an edit box.
This window is not a dialog but an ordinary window.
But when I`m trying save the typed text with GetDlgItemText, WinXP kicks me out.
...
...
WndProc21 proc hWin  :DWORD,uMsg:DWORD,wParam :DWORD,lParam :DWORD ;this is the background window
LOCAL ...; variables

  .if uMsg == WM_COMMAND ;from parent ch2
          .if wParam == sEdit
            .if edit21flag==0 ; not to create twice
            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    ; create edit box, works fine
                mov  edit21flag,1                   
        mov  hEdit,eax
invoke SetWindowLong,hEdit,GWL_WNDPROC,addr EditWndProc
  mov OldWndProc,eax  ; sublassing OK
        invoke ShowWindow,hEdit,SW_SHOWNORMAL
            invoke SetFocus, hEdit
            .endif ;edit21flag==0
          .endif ;wParam == sEdit

  .endif ;

  .if uMsg == WM_CREATE
invoke LoadBitmap,hInstance,IDB_MYB21
mov hBitmapch21,eax                    ;window hatterkep
      invoke GetWindowLongA,hWin,GWL_EXSTYLE  ;**********; alpha blend begin
      or eax,WS_EX_LAYERED
      invoke SetWindowLongA,hWin,GWL_EXSTYLE,eax
      invoke GetModuleHandleA,addr User32
      invoke GetProcAddress,eax,addr SLWA
      mov pSLWA,eax
      push LMA_ALPHA ; only set alpha value
      push 80      ; alpha value
      push 0
      push hWin
      call pSLWA                              ;**********; alpha blend end

  .elseif uMsg == WM_CHAR
        mov eax,wParam
        invoke dwtoa,eax,ADDR buffer3
        invoke MessageBox,NULL,ADDR buffer3,SADD("wmchar,ch21:"),MB_OK


  .elseif uMsg == WM_PAINT ;
invoke BeginPaint,hChild21,addr ps ;ez a resz egy bitmap-et rak ki hatternek, OK.
  mov hdc,eax
invoke CreateCompatibleDC,hdc
mov hMemoryDC2ch00,eax
invoke SelectObject,hMemoryDC2ch00,hBitmapch21
mov hOldBmp2ch00,eax
invoke GetObject,hBitmapch21,sizeof BITMAP,addr bitmap2ch00
invoke StretchBlt,hdc,0,0,500,200,hMemoryDC2ch00,0,0,bitmap2ch00.bmWidth,bitmap2ch00.bmHeight,SRCCOPY
invoke SelectObject,hMemoryDC2ch00,hOldBmp2ch00

invoke DeleteDC,hMemoryDC2ch00
            invoke EndPaint,hChild21,addr ps ;
   
  .endif
        invoke DefWindowProc,hWin,uMsg,wParam,lParam
    ret
WndProc21 endp
;------------------------------
EditWndProc PROC hEdit21:DWORD,uMsg:DWORD,wParam:DWORD,lParam:DWORD ; subclass
.if uMsg==WM_CHAR
mov eax,wParam
.if eax!=0 && eax!=27
invoke CallWindowProc,OldWndProc,hEdit21,uMsg,eax,lParam
ret    ; returns OK
.elseif eax==27
    invoke GetDlgItemText,hEdit21,EditID,edit21buf,255d  ; and here it fais regardless what handle i`m gining to it
                                                                                                  ;
            ;invoke SetFocus,hChild21
                  ;invoke ShowWindow,hEdit21,SW_HIDE
                  ret
.else
invoke CallWindowProc,OldWndProc,hEdit21,uMsg,wParam,lParam
ret
.endif
.endif
 
xor eax,eax
ret
EditWndProc endp
Posted on 2005-06-14 17:56:01 by ola_dina
invoke GetDlgItemText,hEdit21,EditID,addr edit21buf,255d

is my guess

Posted on 2005-06-14 19:28:12 by JimmyClif
Also the Handle passed to GetDlgItemText is supposed to be the dialogs handle. Since in your case there is no Dialog you should probably send a WM_GETTEXT message straight to the edit control.
Posted on 2005-06-15 08:41:37 by Eóin
JimmyCliff you win !
thanks
Posted on 2005-06-16 03:37:51 by ola_dina
And it seems I should try gettext ...
you win too :)
thanks
Posted on 2005-06-16 17:06:30 by ola_dina