Implementing the Property Page and Display Dialog Box
For the Data Transformation Services (DTS) custom task user interface example, you need to implement a property page, which is the user interface for entering custom task properties, and a dialog box for displaying and updating the global variable value.
Implementing the Property Page UI
You can create a property page framework using the Active Template Library (ATL) Dialog template.
To implement the user interface for the properties page
- On the Insert menu in Microsoft® Visual C++®, click New ATL Object.
- On the ATL Object Wizard screen, click Miscellaneous, click Dialog, and then click Next.
- On the Names tab, enter GVPropPage for the short name.
The dialog box editor is displayed.
- Add the following controls to the dialog box, which already includes the OK and Cancel buttons.
Control Type ID Description Static text IDC_TASK_NAME Field for display of the task name. Edit box IDC_TASK_DESCR Field for entry and display of the task description. Edit box IDC_GV_NAME Field for entry and display of the global variable name.
- Assign a suitable caption to the dialog box, and optionally add static text fields to label the above fields. If you add static text fields, accept the default ID of IDC_STATIC.
Example
The dialog box editor will add a script for the property page similar to the following to the resource file DTSTskGVUpdate.rc.
IDD_GVPROPPAGE DIALOG DISCARDABLE 0, 0, 266, 113
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Global Variable Update Properties"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",1,81,93,50,14
PUSHBUTTON "Cancel",2,135,93,50,14
LTEXT "Task Name:",IDC_STATIC,5,5,83,8
LTEXT "<task name>",IDC_TASK_NAME,5,16,256,8
LTEXT "Task Description:",IDC_STATIC,5,31,110,8
EDITTEXT IDC_TASK_DESCR,5,43,255,12,ES_AUTOHSCROLL
LTEXT "Global variable name:",IDC_STATIC,5,63,95,8
EDITTEXT IDC_GV_NAME,5,74,255,12,ES_AUTOHSCROLL
END
Implementing Display and Update Dialog Box
You can create a dialog box framework using the ATL dialog template for the global variable display and update.
To implement the display and update dialog box
- Follow the procedure under Implementing Properties Page UI and enter GVDialog for the short name.
- Add the following controls to the dialog box, which already includes OK and Cancel buttons.
Control Type ID Description Static text IDC_TASK_DESCR Field for display of the task description. Static text IDC_GV_NAME Field for display of the global variable name. Edit box IDC_GV_VALUE Field for entry and display of the global variable value.
- Assign a suitable caption and optionally add static text label fields.
- Click the More Styles tab, and then select the Center check box.
Example
The dialog box editor will add a script for the display and update dialog box similar to the following to the resource file DTSTskGVUpdate.rc.
IDD_GVDIALOG DIALOG DISCARDABLE 0, 0, 256, 65
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Global Variable Update"
FONT 8, "MS Sans Serif"
BEGIN
DEFPUSHBUTTON "OK",1,77,44,50,14
PUSHBUTTON "Cancel",2,130,44,50,14
LTEXT "Task:",IDC_STATIC,5,5,19,8
LTEXT "<task description>",IDC_TASK_DESCR,29,5,219,8
LTEXT "Global variable name:",IDC_STATIC,5,17,69,8
LTEXT "<global variable name>",IDC_GV_NAME,81,17,169,8
EDITTEXT IDC_GV_VALUE,5,29,246,12,ES_AUTOHSCROLL
END