Visual Basic Concepts

Manually Deploying Code Components

Code components are .exe or .dll files, rather than .ocx files. For client-side deployment, you can reference and script ActiveX components with the same kinds of HTML and VBScript code you might use for ActiveX controls. You perform the following steps to deploy a code component to a client:

  1. Use HTML to create a page containing an element to launch the display of the component. For example, you might create a button that would launch the component. Include a name for the element to use in script, a type to show on the page, and a "value" — similar to the Caption property of a command button in Visual Basic.

    The following code shows a sample of what your HTML might look like for a button that references a Login dialog box:

    <FORM NAME="LoginButton">
    Click here to log in:
    <INPUT NAME="cmdLogin" TYPE="Button" VALUE="Log in…">
    </FORM>
    
  2. Use the OBJECT tag to provide a means for the browser to download, register, and reference the ActiveX component. The OBJECT tag includes the component's class ID, a unique identifier used to reference the component, and a CODEBASE attribute to tell the browser where to find the component.

    Note   See "Manually Deploying ActiveX Controls" for an example of the OBJECT tag.

  3. Use VBScript to show the component. The following shows an example of how you would do this for a login dialog component:
    <SCRIPT LANGUAGE="VBScript">
    ' Create variables for the HTML form containing the 
    ' button, and for the object exposing the method that 
    ' shows the dialog box.
    Dim dlgLogin
    Dim TheForm
    Set TheForm = ActiveX document.LoginButton
    ' Include a procedure that shows the dialog box
    ' when the button is clicked.
    Sub cmdLogin_onClick
        Set dlgLogin = Login
        dlgLogin.ShowDialog
    End Sub
    </SCRIPT>
    

In this example, the component itself would include code that forms the login string and sends it to the server for validation.