When I create a document in an MDI app from CMDIFrameWnd, the associated view is automatically created. Now, I want to pass the View (a subclass of CMDIChildWnd) some parameters from CMDIFrameWnd (which are independent of the document).
The view will use these parameters for drawing its client area, and hence they have to reach the view before ::OnCreateClient is called.
Can anyone help here, and give me some hints/ articles to read to implement this behaviour?
Re: Passing Parameters to a View from CMDIFrameWnd
Originally Posted by piedpiper
which means that there is no way to pass the parameter?
Would this approach of accessing back the main window thread-safe? Is there any way a second view is created by the time I access the main app from MDIChildWnd (and hence the parameters change)?
There seem to be some design issues the way you described your question.
You don't create documents from CMDIChildWnd and views aren't subclassed from CMDIChildWnd, so I'm not really sure how to answer you, but no, I don't believe you can pass parameters directly from the main window to the CMDIChildFrame of the view during creation without overriding parts of the framework.
The document object is created before the views though, so perhaps you could put some parameters in there of use OnInitialUpdate in the view class to get info from the doc.