共用方式為


InitInstance Member Function

OverviewHow Do ITutorial

Windows allows you to run more than one copy, or "instance," of the same application. WinMain calls every time a new instance of the application starts.

The standard InitInstance implementation created by AppWizard performs the following tasks:

  • As its central action, creates the document templates that, in turn, create documents, views, and frame windows. For a description of this process, see Document Template Creation.

  • Loads standard file options from an .INI file or the Windows registry, including the names of the most recently used files.

  • Registers one or more document templates.

  • For an MDI application, creates a main frame window.

  • Processes the command line to open a document specified on the command line or to open a new, empty document.

You can add your own initialization code or modify the code written by the wizard.