News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Child Window Makes Parent Inactive

Started by raleeper, August 09, 2011, 12:46:40 AM

Previous topic - Next topic

raleeper

Please ignore this topic.  Further work has shown the problem description inaccurate and made the code obsolete.   I'm sorry to have wasted your time and space.  Thanks, ral.

-----

Well, I have my child window up and accepting (and processing) keyboard input.  It Beeps on any key it doesn't recognize (not yet set up).  It recognizes 2 keys: escape - on which it properly exits via DestroyWindow - and "back" (VK_BACK), which is supposed to leave the child active, but return focus to the parent.

Focus appears to return to the parent (the titlebars change color), but it does not appear to be receiving messages (except that - wierdly, it seems to me, it does respond appropriately to escape).  The child remains displayed, presumably because the parent is not repainting itself.


The relevant code is:

ckey:
cmp dl, 1Bh
  jz CWP_des

cmp dl, 8
  jz ckey_par


call erbeep

  jmp CWP_end


ckey_par:
invoke SetFocus,hwnd

or eax, eax
  jnz @F
call erbeep
call erbeep
call erbeep
@@:
  jmp CWP_end


-------

CWProc proc cwphw,msg,wparam,lparam

pushad

mov eax, [cwphw]
mov [hCWnd], eax

mov edx, [wparam]

mov ecx, [lparam]

mov eax, [msg]

cmp eax, WM_DESTROY
  jz CWP_des

cmp eax, WM_PAINT
;   jz CWP_pai

cmp eax, WM_KEYDOWN ;100
  jz ckey

cmp eax, WM_SYSKEYDOWN
;   jz ckey_s

cmp eax, WM_LBUTTONDOWN ;201
;   jz cmseb

cmp eax, WM_LBUTTONUP ;202
;   jz cmseu

cmp eax, WM_MOUSEMOVE ;200
;   jz cmmov

cmp eax, WM_SETFOCUS
;   jnz CWP_stf


CWP_def:
popad

invoke DefWindowProc,cwphw,msg,wparam,lparam

ret


CWP_des:
invoke DestroyWindow,hCWnd

  jmp CWP_end

CWP_end:
popad

xor    eax,eax

ret


cmp eax, WM_SETFOCUS          ;This is part of the parent's windows procedure.  This
  jnz @F                                                 ;should be superfluous, but it was one of the things I tried
invoke InvalidateRect, hWnd,0,0          ;These comments were added after the zip file was attached.
  jmp WP_def
@@:



erbeep beeps by setting variables and calling Beep.