• Create Account

# Couple of questions on CMDIChildWndEx MFC class

Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

No replies to this topic

### #1StakFallT  Members   -  Reputation: 245

Like
0Likes
Like

Posted 09 December 2013 - 08:56 PM

How does one go about creating an instance of a ChildFrame manually? (hmmm... Maybe I should rewind a little...)

After my original post (I don't have the link handy, sorry; it should still be visible either on the first page or second) I thought I had stablized my hierarchical design of view classes and the dynamic creation of them through CreateView bypassing the whole RUNTIME_CLASS macro thing. But as most things with this project, it was only a tease. I soon came to find that I was getting errors about the row x col being in use. So I tried 0,0, and 1,1; nothing seemed to work.I eventually came to the conclusion (Which I think is still incorrect) that the dockable panes, the app-wizard-generated-project autogenerated, were taking up those slots despite them being, what I beleive, part of MainFrame NOT ChildFrame. Which makes absolutely no logical sense since ChildFrame is UNDER MainFrame, and thus ChildFrame should be allowed to have it's own content dealt with without interference from MainFrame. Anyhow, I eventually came to the conclusion that that was the case, since it was the only theory I could come up with. Which is my first question -- why on Earth would I get the error about row x col in use when trying to CreateView inside of the ChildFrame when no other views have been created inside of it???

My second question, in an effort to try to get a handle on some of this, I'm setting about trying to manually create an instance of a ChildFrame which is derived from CMDIChildWndEx. How does one go about doing that? It appears the main source file is triggering ChildFrame's OnCreateClient function by a call to ProcessShellCommand(cmdInfo); problem is, there are two parameters the OnCreateClient function takes. I'm guessing even if I could call OnCreateClient directly there probably ought to be some sort of setup prior to making the call so that I can pass in the proper parameters; but I have no idea where the "CCreateContext* pContext" parameter is coming from. The first parameter is "LPCREATESTRUCT lpcs" which I'm guessing is something I can spin up myself, just by creating an object of that type and filling in the proper values -- but the CCreateContext parameter is something that I'm a bit more baffled by. Thanks, as always, in advance!

-- StakFallT

EDIT: Correction, it seems the OnCreateClient is created via the code:

pDocTemplate = new CMultiDocTemplate(IDR_WorldBuilTYPE,
RUNTIME_CLASS(CWorldBuilder_SceneDoc),
RUNTIME_CLASS(CChildFrame), // custom MDI child frame
RUNTIME_CLASS(CWorldBuilderView));


Which appears quite a bit before the ProcessShellCommand call. Problem is, I don't really want to utilize document templates.

Edited by StakFallT, 09 December 2013 - 09:42 PM.