Share via


Inserting a Form into a Project

Forms provide a convenient container for controls. You can easily insert an MFC-based form into your application, so long as the application supports the MFC libraries.

forms, inserting into a project; forms, adding to a project; inserting forms; Insert New dialog box; forms, Insert New Form dialog box

To insert a form into your project

  1. From ClassView, select the project to which you want to add the form, and click the right mouse button.

  2. From the shortcut menu, choose New Form.

    If the New Form command is not available, your project may be based on the ActiveX Template libraries (ATL). To add a form to an ATL project, you must when first creating the project.

  3. In the New Form dialog box, type a name for the form.

    The remaining fields under Form Information are automatically generated from the form name.

  4. Use the Automation area to specify whether the form will support automation.

  5. Use the Document Template Information fields to specify information about the document associated with the form.

  6. Click Change if you want to change the generated file extension, or other aspects of the template such as the name displayed in the Save as Type dialog box, the New dialog box, and so forth.

Visual C++ adds the form to your application, opening it inside the Dialog editor so that you can begin adding controls and working on its overall design.

You may want to perform the following additional steps (not applicable for dialog-based applications):

  1. Override the OnUpdate member function.

  2. Implement a member function to move data from your view to your document.

  3. Create an OnPrint member function.

For more information, see .