Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

wall

MFC Question

This topic is 5998 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

Hi! I''m new to MFC and the AppWizard thingy, and I''m wondering how to call a function in the CProjectNameView class from the CMainFrame class, since CMainFrame doesn''t have access to CProjectNameView.

Share this post


Link to post
Share on other sites
Advertisement
Generally, you shouldn''t.

You can try GetActiveView from the main frame, see if it''s the right kind of view via IsKindOf, and then statically cast it to the class you want, but this is pretty sloppy.

Generally, the frame shouldn''t talk to the views. It should talk to the document and the document should talk to the views. Ideally, anything the frame needs to do should produce commands which are then handled by the document (or the active view). Look at the command routing topic in MSDN (VC++ Programmer''s guide).

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!