Building a DTS Custom Task with a User Interface from the ATL Custom Task Templates

DTS Programming

DTS Programming

Building a DTS Custom Task with a User Interface from the ATL Custom Task Templates

To build a custom task with a user interface, use the Active Template Library (ATL) custom task templates, which support a user interface. These templates are included in the Microsoft® SQL Server™ 2000 Data Transformation Services (DTS) sample programs. The basic template does not support a user interface. For more information about DTS samples, see DTS Programming Samples.

Installing the ATL Custom Task User Interface Templates

To install the ATL custom task user interface templates, do the following:

  1. Copy all the files in the DTSTaskUITemplates folder except DTSCuTskUI.reg to C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Template\ATL\. This location will be different if Microsoft Visual Studio® version 6.0 was not installed to the default location.

  2. Double-click DTSCuTskUI.reg to run the file.
Building a Custom Task Framework from the Templates

You can create an ATL component that includes both a custom task class that supports a custom user interface, as well as a user interface class, by using the Microsoft Visual C++® development environment.

To build a custom task framework from the templates

  1. On the File menu, click New, and then click the Projects tab.

  2. Click ATL COM AppWizard, and then enter a project name and location.

    Assume you entered DTSCusTskWUI for the project name.

  3. Click Dynamic Link Library (DLL), click Finish, and in the New Project Information dialog box, click OK.

  4. On the Insert menu, click New ATL Object.

  5. On the ATL Object Wizard screen, click DTS Custom Objects, click DTS Task w/ UI Support, and then click Next.

  6. On the Names tab, enter a short name.

    Assume you entered TaskUISupp. The wizard will fill in the other fields. The COM/Type field is the name that will appear in the Task menu of DTS Designer, You can change it from the default TaskUISupp Class.

  7. Click the Attributes tab, and then do the following:
    • Under Threading Model, click Both.

    • Under Interface, click Dual.

    • Under Aggregation, click No.

    • Select the Support ISupportErrorInfo check box.
  8. Again, on the  Insert menu, click New ATL.

  9. On the ATL Object Wizard screen, click DTS Custom Objects, click DTS Task w/ UI Support, and then click Next.

  10. On the Names tab, enter a short name.

    Assume you entered UserIF. The wizard will fill in the other fields.

  11. Click the Attributes tab, and then do the following:
    • Under Threading Model, click Apartment.

    • Under Interface, click Dual.

    • Under Aggregation, click Yes.

The wizards will create files for the DTSCusTskWUI component and the TaskUISupp and UserIF classes and save them to the project location folder specified in Step 1.

If you build this custom task project from the Build/Build DTSCusTskBasic.dll menu before adding any custom code, you install a custom task that will appear in the Task menu of DTS Designer and can be included in a DTS package. When added to a package, the task will use the DTS default icon. Until code is added to the IDTSCustomTaskUI methods, it will display the DTS default property grid. However, this task will not perform any function when the package is run. For more information about implementing and testing a custom task, see Implementing and Testing a DTS Custom Task.