tags:

views:

51

answers:

1

I have several forms that have common sections and I would like to pull them out into their own resource. Basically I am looking for a way to make a CFormView into a windows control that I can insert into another CFormView.

A: 

You can create a modaless dialog from the same resource template and create it on a form view. This means you need to refactor your code so the event handlers can be reused between the dialog and your original form view.

CFormView expects it's parent to be a frame. To remove that dependency you need to override all functions that reference the parent frame, which is tedious to do, and each version of MFC may introduce new functions that references the parent frame.

Sheng Jiang 蒋晟
Wouldn't you embed the cFormView's frame as well?
Aaron Fischer
That would require the same amount of work (basically the frame does not expected a parent that is not a MDI Frame. To change this assumption requires overriding a lot of functions. It may need extra works in the rounting frame of the thread state, floating windows notification, keyboard navigation, menu merging, view window activation and print preview too. There are a lot of code in MFC that jump to GetTopLevelParent or GetTopLevelFrame for the main frame instead of calling GetParentFrame.
Sheng Jiang 蒋晟