
Opening a new MDI child when no MDI Child exists
You're not accessing the doc template object - you can't just call a class
function without an object......
Look in yourapp.cpp, where AppWizard creates the Doc Template, usuallt
pDocTemplate - you might have to access it via the Doc object itself, though
i am not sure how to do this
Here's what you should of done...
(Assuming your app defined doc template is called pDocTemplate and you want
to access it directly)
pDocTemplate.CreateNewFrame(NULL, NULL);
or if you are accessing a pointer to it(via some call to the doc object to
get the doc template)...
pDocTemplate->CreateNewFrame(NULL, NULL);
In C++, you have classes and objects. CDocTemplate is a class - and your
document template(the object that defines what type of document your app
excepts, usually defined as a string in the resource file) is an instance of
that class. So when a programmer writes CDocTemplate::CreateNewFrame() we're
actually saying, get the object of type CDocTemplate and then call the
CreateNewFrame function of that object - by whatever name that object is.
Hope this helps,
Josh
Quote:
> Ajay,
> I'm having trouble getting this to work. In my MainFrame module, I have a
> function that executes whenever someone clicks LOCATE-->SEARCH (I want
> to click on items in my MAINFRAME toolbar such as LOCATE-->SEARCH and have
the
> function to create a new frame/view/document.). In this module, I have
> CDocTemplate * pmyDoc;
> pmyDoc = CDocTemplate::CreateNewFrame(NULL, NULL);
> However, I get error C2352 illegal call of non-static member function.
> Obviously, I'm not on the right track.
> Can someone give me an example on how this is done?
> Chuck
> > You can create a new frame using CDocTemplate::CreateNewFrame().
> > --
> > Ajay Kalra
> > Microsoft VC++/MFC MVP
> > NOTE: Please post all replies to newsgroup.
> > > This is a rewording of a message I posted on Friday, January 14, 2000.
> > > My ISP ran out of disk space and I was not able to receive any new
> > > messages Friday or Saturday. Forgive me if someone has already posted
a
> > > response.
asked
> > > under the subject "Opening a new MDI child from a MDI Child".
> > > ------------------------------------------------------
> > > I want to open up a child window when no child window exists (only
> > > MAINFRAME exists). I do not want to use FILE-OPEN processing. I want
> > > to click on items in my MAINFRAME toolbar (such as LOCATE-->SEARCH).
> > > How can I open a new MDI child when no MDI child exists?
> > > Thanks in advance.
> > > Chuck Davis