Share via


Wizard Interface (IDTWizard)

Applies to: yesVisual Studio noVisual Studio for Mac

Note

This article applies to Visual Studio 2017. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

The integrated development environment (IDE) uses the IDTWizard interface to communicate with wizards. Wizards must implement this interface in order to be installed in the IDE.

The Execute method is the only method associated with the IDTWizard interface. Wizards implement this method and the IDE calls the method on the interface. The following example shows the signature of the method.

/* IDTWizard Method */
STDMETHOD(Execute)(THIS_
   /* [in] */ IDispatch *Application,
   /* [in] */ long hwndOwner,
   /* [in] */ SAFEARRAY * *ContextParams,
   /* [in] */ SAFEARRAY * *CustomParams,
   /* [out] [in] */ wizardResult *RetVal
   );

The start mechanism is similar for both the New Project and Add New Item wizards. To start either, you call the IDTWizard interface defined in Dteinternal.h. The only difference is the set of context and custom parameters that are passed to the interface when the interface is called.

The following information describes the IDTWizard interface that wizards must implement to work in the Visual Studio IDE. The IDE calls the Execute method on the wizard, passing it the following:

  • The DTE object

    The DTE object is the root of the Automation model.

  • The handle to the window dialog box as shown in the code segment, hwndOwner ([in] long).

    The wizard uses this hwndOwner as the parent for the wizard dialog box.

  • Context parameters passed to the interface as variant for SAFEARRAY as shown in the code segment, [in] SAFEARRAY (VARIANT)* ContextParams.

    Context parameters contain an array of values that are specific to the kind of wizard being started and the current state of the project. The IDE passes the context parameters to the wizard. For more information, see Context Parameters.

  • Custom parameters passed to the interface as a variant for SAFEARRAY as shown in the code segment, [in] SAFEARRAY (VARIANT)* CustomParams.

    Custom parameters contain an array of user-defined parameters. A .vsz file passes custom parameters to the IDE. The values are determined by the Param= statements. For more information, see Custom Parameters.

  • Return values for the interface are

    wizardResultSuccess = -1,
    wizardResultFailure = 0
    wizardResultCancel = 1
    wizardResultBackout = 2
    

See also