Jump to content
  • Advertisement
Sign in to follow this  

Couple of questions on CMDIChildWndEx MFC class

This topic is 2138 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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(CChildFrame), // custom MDI child frame

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

Edited by StakFallT

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!