Archived

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

wall

MFC Question

Recommended Posts

wall    134
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
Stoffel    250
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