-
June 7th, 2011, 08:17 AM
#1
Passing Parameters to a View from CMDIFrameWnd
Hi,
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?
-
June 7th, 2011, 08:44 AM
#2
Re: Passing Parameters to a View from CMDIFrameWnd
AfxGetMainWnd() will give you a pointer to your app's main window.
-
June 7th, 2011, 08:54 AM
#3
Re: Passing Parameters to a View from CMDIFrameWnd
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)?
-
June 7th, 2011, 09:19 AM
#4
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.
Last edited by GCDEF; June 7th, 2011 at 09:21 AM.
Tags for this Thread
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
|