As with the implementation for the CustomTask object, there is a corresponding implementation required
for the user interface. Add the CustomTaskUI implementation to the declaration section of your existing
Class module
|
'Required for CustomTask with User Interface
Implements DTS.CustomTaskUI
|
The CustomTaskUI object has seven methods, all of which must be defined regardless of usage
|
Private Sub CustomTaskUI_Initialize(ByVal pTask As Task)
Dim oCustomTask As MyCustomTaskUI.CustomTask
'Set current task to a global task variable
'This is used by the form to retrieve values
Set oTask = pTask
'Set the Default Task values here
MsgBox "CustomTaskUI_Initialize"
End Sub
Private Sub CustomTaskUI_Help(ByVal hwndParent As Long)
'Not Used
End Sub
Private Sub CustomTaskUI_Delete(ByVal hwndParent As Long)
MsgBox "CustomTaskUI_Delete"
End Sub
Private Sub CustomTaskUI_CreateCustomToolTip(ByVal hwndParent As Long, _
ByVal x As Long, ByVal y As Long, plTipWindow As Long)
'Not Used
End Sub
Private Sub CustomTaskUI_New(ByVal hwndParent As Long)
' Called when you add the task to a Package
MsgBox "CustomTaskUI_New"
frmCustom.Show vbModal
End Sub
Private Sub CustomTaskUI_Edit(ByVal hwndParent As Long)
' Called when you edit the Task, i.e. Double-Click the icon
MsgBox "CustomTaskUI_Edit"
frmCustom.Show vbModal
End Sub
Private Sub CustomTaskUI_GetUIInfo(pbstrToolTip As String, _
pbstrDescription As String, _
plVersion As Long, pFlags As DTSCustomTaskUIFlags)
'Not Used
End Sub
|
The interface is a standard Form object. Add a form to your project, ensuring the name
is referenced correctly in the New and Edit methods. The examples above use a formed named
frmCustom.
In the Initialise method, you will notice that our CustomTask object, pTask,
is passed to the user defined variable oTask. It is very important that oTask is
available to the Form, as it is used to gain reference to the underlying CustomTask object, from which
we can read and write the CustomTask properties. To do this I recommend adding Module to your project,
with the following code
|
'The variables declared below are used to pass values
'between the Class and the Form
Public oTask As DTS.Task
|
Next we must add code to the form, and finally compile and register the CustomTask -
Next Page