User Control: Creating Data PlugIn

By creating a simple ActiveX component and setting properties in the User control, you can easily and quickly create a fully multi-threaded Visual Basic application.

Instructions:
  1. Create a new ActiveX application as described fully in your MSDN help (search on ActiveX EXE sample project).

  2. Add a Project Reference to VBVDataPlugIn.tlb found in VBVoice root directory (...\Pronexus\VBVoice \VBVDataPlugIn.tlb) by browsing to the specified location.

  3. In the General declarations of your Class Module, add these lines of code:

Option Explicit

'add Project Reference to VBVDataPlugIn.tlb found in VBVoice root directory by browsing

Implements DataPlugin 'Specifies the DataPlugin interface

  1. Click the arrow to the right of the Object Box list box to display a list of all objects associated with your class.

  2. Select DataPlugin object.

  3. DataPlugin should be declared as follows:

Private Function DataPlugin_DoRequest(ByVal action As String, _

ByVal arg1 As String, _

ByVal arg2 As String, _

ByVal arg3 As String, _

ByVal arg4 As String, _

ByVal arg5 As String) As String

Note that Do Request function is prototyped in VBVDataPlugIn.tlb. Do not change this declaration or any of its parameters!

You are now ready to implement DataPlugin_DoRequest function. Note the parameters action and arg1 to arg5 are properties set in the VBVoice User control. Also note that DataPlugin_DoRequest function returns a string containing the result.

  1. In your VBVoice application, add a User control (to simplify use User1 as the control name).

  2. In the User1_Enter Event, set the User1.PlugIn_Action(channel), User1.PlugIn_Arg1(channel) to User1.PlugIn_Arg5(channel) and User1.PlugInName(channel). Note that you do not have to set arg1 to arg5, however, an action and PlugInName are required.

  3. In the User1_Exit Event, your return value should be returned in User1.Value(channel) property.

  4. A new VBVoice example called InventryPlugIn and its ActiveXServer called CustomPlugIn have been created and can be found in the ...\VBVoice\Examples\InvertyPlugIn\ directory.

Read more about User control.