I have an MFC MDI app based on Doc/View Architecture. The problem is that I want to pass some parameters to the View class from the main frame "before" OnCreateClient
is called. I am not sure how I can do that as most of the stuff in the doc/ view architecture is done under the hood.

- 3,079
- 3
- 28
- 44
-
You can try using a [UDF(user defined message)](http://www.codeproject.com/KB/tips/gbTestSDI.aspx); plus, I found [codeguru](http://www.codeguru.com/forum/forumdisplay.php?f=7) to be more helpful in VC++ areas. – KMån Jun 15 '11 at 13:40
1 Answers
Vague question can only be met with vague answers. Please clarify what your parameters do. Are they view-specific? Document-specific? Not visible to the user?
If your problem is that you have multiple view classes which all use a shared data structure, you could use make the shared data structure a global variable which you initialize in your CWinApp-derived class. Or you could (multiply-)derive them from (both CView and) a parent class that manages the shared data structure.
You could read your parameters from the Windows registry. You might want to do this to save the sizes of windows, their styles, etc.
I don't see what OnCreateClient has to do with any of it, though. If CView::GetDocument() returns NULL then your CView-derived class shouldn't be trying to draw anything.

- 698
- 6
- 14
-
I think the question already answers the "clarification" questions you have asked. I have mentioned that I need the parameters in the View class; so, its implicit that they are view-specific. I also said that I want to pass them from the main frame (so registry suggestion is out). I need them before `OnCreateClient` because my drawing of client area depends on those parameters. – Jaywalker Jun 07 '11 at 08:53