Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is the sequence of events on window activation?

Status
Not open for further replies.

panioti

Programmer
Jan 5, 2005
15
US
In an sdi application, I have created several additional CFormViews, and switch between them. A view/window could have 50-70 controls plus a lot of static text. The views are created in CMyApp, and also switched there. The switching function ends with:

pActiveView->ShowWindow(SW_HIDE); //last window
pNewView->ShowWindow(SW_SHOWMAXIMIZED); //new window
((CFrameWnd*) m_pMainWnd)->SetActiveView(pNewView);
((CFrameWnd*) m_pMainWnd)->RecalcLayout();

pNewView->Invalidate();
pNewView->SendMessage(WM_APP + 1, 0, 0);

This worked fine until I decided to send that WM_APP message, to massage some of the controls when first displayed. Processing this message in the new CMyFormView seems to be concurrent with window creation. When looping thru the controls, CMyFormView will reach a control that hasn't been created yet. It moves around depending on where the breakpoints are. I've tried SendNotifyMessage, with no change in the result.

Can someone suggest a safe entry method, after all window controls have been created.

The next thing I will try is to simply set a "NewPage" flag on receipt of this msg, then do the processing on the first Setfocus msg received.
 
Oh how embarrassing--it was just a simple coding error after all.

I really try to figure out what's wrong before I ask a question; I just didn"t go far enough this time.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top