Deploying ActiveX Components

There are two methods of deploying ActiveX components: you can either deploy them using Regsvr32 or you can deploy them in a more automated fashion using Visual InterDev 6.0. The remote deployment capabilities for middle-tier COM server components is one of the exciting new features in Visual InterDev 6.0. In this section, we'll see how both of these procedures are performed.

Using Regsvr32

Regsvr32 is a program that allows you to register components from the command line. You can launch Regsvr32 either from within the Run dialog by choosing Start|Run or from within the DOS Command Prompt by choosing Start|Programs|MS-DOS Prompt. Regsvr32 has the following syntax:

     Regsvr32 [/u] [/s] [/n] [/i[:cmdline]] dllname     Where     dllname - Component to register     cmdline - Optional command line parameters     /u - Unregister server     /s - Silent; display no message boxes     /c - Console output     /i - Call dllinstall passing it an optional [cmdline];          when used with /u calls dlluninstall     /n - Do not call dllregisterserver;          this option must be used with /i 

The most common usage of Regsvr32 is simply to call it and pass it the name of the component that you want to register, as shown in the following example.

     C:\regsvr32 vibank.dll 

Of course, Regsvr32 has to be run locally on the machine on which you want to register the component. You also have to manually copy the component DLL file to the machine prior to registration. Figure 18-9 shows the output message box after the component has been successfully registered.

Figure 18-9. The message box displayed after a component has been successfully registered using Regsvr32.

Using Visual InterDev 6.0 to remotely deploy the component can be much more convenient as we'll see in the next section.

Using Visual InterDev 6

Now that we've seen how to deploy a component using Regsvr32, let's take a look at the equivalent operation within Visual InterDev 6.0. For developers, this is a much more straightforward approach—you develop your component on a workstation along with your Web project and then deploy the component to the server remotely.

NOTE
To register components through Visual InterDev on a remote Web server, the Web server must have IIS installed with the Visual InterDev RAD Remote Deployment Support option selected during custom installation.

The first step is to add your component to a Web project:

  1. Open up your Web project.
  2. Create a folder named Components under your Web project. This step is not required but is good practice so that your middle-tier components are kept separate from your HTML and ASP code.
  3. Prepare to add the component to the Components folder by right-clicking the folder and choosing Add|Add Item.
  4. In the Add Item dialog box, choose the Existing tab.
  5. Locate your ActiveX DLL file, and then click Open.

Your component will now be added to your Web project.

Figure 18-10 shows the Project Explorer with an ActiveX DLL named vibank.dll added to the Components folder within the VI-Bank Web project.

Figure 18-10. The Project Explorer within Visual InterDev 6.0 showing a component that has been registered remotely.

Now that the component has been added to your Web project, you are ready to register it on the server. You can do this as follows:

  1. Right-click the component, and choose Properties from the context menu.
  2. Choose the Component Installation tab on the Properties dialog box.
  3. Check the Register On Server box. (See Figure 18-11.)
  4. Click OK.

Figure 18-11. The Component Installation tab of the component Properties dialog box.

After you select OK, the component will be registered on the server. You'll be able to see the sequence of events by watching the status bar in the lower left corner of the screen.

NOTE
If your master Web server and local project are on the same computer, the registry for that machine notes the component only once, not once each for the master and local version. If you remove the local copy, the registry entry for the component is also removed, even though the component is marked as a server component in the project.

If you want to deploy your entire Web project, including components, to another destination Web server (that is, not your local or master Web server), you can use Visual InterDev to register the components. You can do this as follows:

  1. In the Project Explorer, select the Web project that you want to deploy.
  2. Choose Web Project|Copy Web Application from the Project menu.
  3. In the Copy Project dialog box, choose which copy of your application you want to deploy (local or master copy), enter the name of the Web server to which you want to deploy, and enter a name for the Web project.
  4. Select the Register Server Components check box to register your components on the new Web server. (See Figure 18-12.)

Figure 18-12 shows the Copy Project dialog box with the Register Server Components check box marked. In this example, the VI-Bank Web project is being copied to a Web server named testserver.

click to view at full size.

Figure 18-12. The Copy Project dialog box showing the Register Server Components check box. This dialog box is used to copy a Web project, including components, from one server to another.



Programming Microsoft Visual InterDev 6. 0
Programming Microsoft Visual InterDev 6.0
ISBN: 1572318147
EAN: 2147483647
Year: 2005
Pages: 143

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net