-
February 27th, 2004, 11:14 AM
#1
Dialog Activation
My application consists of a mainframe window that can display multiple modeless dialogs. At a given time multiple dialogs can be open.
My question is:
What message can the dialog trap to know that it is brought into focus? I need to know this so that when the dialog is brought into focus it can set certain global variables.
I tried trapping the WM_SETFOCUS message...but that does not get message does not get activated when the dialog is brought into focus.
Any help is greatly appreciated.
Thanks,
MD
-
February 27th, 2004, 11:31 AM
#2
-
February 27th, 2004, 11:39 AM
#3
Try trapping WM_ACTIVATE.
Steve
-
February 27th, 2004, 11:56 AM
#4
Thanks for your replies.
I did try WM_ACTIVATE in my dialog....but that does not get invoked.
Does this have something to do with the fact that my dialogs are modeless?
This is a sample:
void SReviewInterestDlg::OnActivate(UINT nState, CWnd* pWndOther, BOOL bMinimized)
{
SViewDlg::OnActivate(nState, pWndOther, bMinimized);
// TODO: Add your message handler code here
}
Thanks
MD
-
February 27th, 2004, 12:06 PM
#5
Put a trace statement in your OnActivate() handler, before the base class fxn is called. You should see that it gets called when the modeless dialog gets the focus and loses the focus. I just tried it and confirmed that a modeless dialog does get the WM_ACTIVATE message.
Steve
-
March 1st, 2004, 03:12 PM
#6
sstofka - Thanks for your reply again....my problem was:
I just realized that my modeless dialog was a child window of CMDIChildWnd. The activate calls were being trapped CMDIChildWnd. So WM_ACTIVATE was not invoked for my dialog. But WM_MDIACTIVATE was invoked for CMDIChildWnd. In this method I was able to receive a handle to my modeless dialog...which is of type CWnd and I cast it to CDialog.
Thanks,
MD
-
March 1st, 2004, 04:18 PM
#7
That's an interesting point, md, with the MDI window. Thanks for the follow up.
Steve
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|