Losing focus LOSES BTN_CLICKED events! 
Author Message
 Losing focus LOSES BTN_CLICKED events!

Hey, all.

I'm writing an MFC dll that's embedded inside of another application, and my
user interface is a modeless dialog box that has VCR-like controls in it to
control the running of my code.  My code makes things move around in the
host application's window (basic animation).

I step my animation when I recieve idle events from the host app, so I'm
tied into its event loop--the whole thing is done on a single thread.

The problem is that when I move things in the host application, the app's
main frame window grabs the focus from my dialog.  When this happens,
messages sent to my dialog's buttons get 'lost'.  I can push the buttons,
see them actually depress, and I *NEVER* get the notifications from Windows.
In order to kick off the whole runs, I have to press a button in the very
same window, and I do get that notification.

To put it simply, I've pulled a lot of hair out about this one, and all I
can figure is that the focus shift from the modeless child dialog window
(mine) to the containing app's window is causing the button messages to get

Can anyone describe this so it makes some sense?  Any workarounds/window
modes that might be useful?  I already have my dialog as the topmost window;
it stays on top, but just loses the focus...presumably the input focus.  My
theory is that Windows is make to send command messages to the active window
or something like that, and when the input focus leaves my window and shifts
to the main frame, that the frame handles the messages and I never see them.
The main frame would probably hand the messages to its default handler,
since it wouldn't have controls with matching IDs or something.  It's crazy
to me that my window isn't getting the messages.

Oh yeah---and I *DO* get breathing room...the idle events fire at the end of
each animation frame, so the problem *isn't* that the app is doing constant
processing or anything like that.  It realy just seems that the messages are
getting mis-routed.

-Kirk out.

ps -- Sorry about the length of the post; just wanted to get all the info
out there.

Sun, 08 Jul 2001 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Identifying which control lost focus on button click event

2. Lost Data Exchange Control->Now losing sanity :-)

3. System wide Message Hook not working when caller app loses focus

4. force a control to LOST FOCUS~!!!!

5. How can you check for Lost Focus in a Composite Control

6. ATL ActiveX control loses focus when VB form displayed

7. Catch losing/getting FOCUS

8. ATL Control Doesn't Lose Focus?

9. ActiveX control losing focus

10. InfoViewer loses keybord focus

11. More than losing focus

12. losing keyboard focus


Powered by phpBB® Forum Software