How can I fix my window focus problem?

Posted by Ben313 on Stack Overflow See other posts from Stack Overflow or by Ben313
Published on 2010-05-31T14:25:29Z Indexed on 2010/05/31 14:33 UTC
Read the original article Hit count: 131

Filed under:
|
|

I have a very frustrating bug in an application I am working on. The routine is supposed to do something in one window, and then return focus to the other at the end of the method, but when I started to use a large data set the other day, the focus stopped returning at the end. I stepped through the code one line at a time, and the errors stopped. so, i figure its a timing issue of some kind. I trace through until i find what i suspect is the culprit. A call to ShellExecute(...), that terminates an image editor i use. (http://msdn.microsoft.com/en-us/library/bb762153(VS.85).aspx)

Now, if I step past this call, and then continue to run the program, everything works fine, but if I just run past this line, the error occurs. how can this be? I have a call to SetFocus() at the very end of this method. shouldnt the program hit this no matter what?

This is all so very frustrating...

© Stack Overflow or respective owner

Related posts about c++

Related posts about Windows