May 7th, 2013, 03:45 PM
[RESOLVED] MFC C++ multiple OnSetActive() calls happening at once
I have a bit of an odd issue. I maintain a piece of software that appears to be handling multiple calls to OnSetActive() at once.
The problem manifests when performing a large image operation. OnSetActive forces the form to redraw, and a lengthy image operation takes place. Before it is finished OnSetActive() is called again. I've come to this conclusion by putting modal "Before" and "After" AfxMessageBoxes before and after the image operation. You'll see "Before" display multiple times.
From there, I replaced the image operation with a Sleep().
and the same thing happened.
Note: This only happens when running the release, this does not happen while debugging.
Aside from the obvious flaw that a lengthy operation is being performed that freezes the program.. can someone tell me how what I'm witnessing is possible? If the AfxMessageBox is modal, how is it possible for OnSetActive() to run again before the second message box is reached? Are the message handlers multi-threaded by nature?
I tried to reproduce this in a demo environment, but was unable to. Does anybody have any insight into what might be causing this?
Tags for this Thread
Click Here to Expand Forum to Full Width
This is a Codeguru.com survey!