noodles1
Programmer
- Oct 31, 2001
- 58
I have a simple dialog-based application using MFC.
I have the need to perform some specific actions when the application gains focus. I expect that the logical way to do this would be to override the OnSetFocus method that is called when a WM_SETFOCUS message is sent to the app.
I'm using VC++ 6.0 SP3.
I'm a little puzzled as to why the WM_SETFOCUS message does not appear in ClassWizard for my dialog class. To get around this, I can manually add the necessary defintions to the MESSAGE_MAP for WM_SETFOCUS and my dialog-class specific implementation of OnSetFocus.
This appears to work satisifactorily, meaning that my override method is called when the dialog gains focus from a Minimised state. However, when the dialog gains focus, either through Alt-Tab or when brought to the foreground from a non-Minimised state, the override OnSetFocus method does appear to be called. I'm guessing here that a different message is sent in these circumstances.
Can anyone provide any suggestions, firstly as to why the WM_SETFOCUS message does not appear in ClassWizard, and what message is being sent?
I have the need to perform some specific actions when the application gains focus. I expect that the logical way to do this would be to override the OnSetFocus method that is called when a WM_SETFOCUS message is sent to the app.
I'm using VC++ 6.0 SP3.
I'm a little puzzled as to why the WM_SETFOCUS message does not appear in ClassWizard for my dialog class. To get around this, I can manually add the necessary defintions to the MESSAGE_MAP for WM_SETFOCUS and my dialog-class specific implementation of OnSetFocus.
This appears to work satisifactorily, meaning that my override method is called when the dialog gains focus from a Minimised state. However, when the dialog gains focus, either through Alt-Tab or when brought to the foreground from a non-Minimised state, the override OnSetFocus method does appear to be called. I'm guessing here that a different message is sent in these circumstances.
Can anyone provide any suggestions, firstly as to why the WM_SETFOCUS message does not appear in ClassWizard, and what message is being sent?