Downloading Components From the Server

To function properly, the form of the IPM.Post.EnhancedLitCrit message class requires that LitCritC.dll be installed on the client computer. Before it can be installed it must be downloaded, in the form of a .cab (cabinet) file from the Web server where the CML/LitCrit application is installed.

As the EnhancedLitCrit form is opened for the first time, it automatically browses to a Web location to download this component, using the standard Web protocol for .cab files. To minimize interruption for the user, a form page called Browser is used that contains the Microsoft Web Browser ActiveX control (shdocvw.dll). If the form fails when it tries to instantiate the LitCritC component, it assumes the LitCritC component is either not installed or improperly installed. At this point, it makes visible this Browser page and instructs the browser control to navigate to http://<server name>/FmLib/LitCritC/install.htm.

Important  For this download to succeed, the user's Microsoft Internet Explorer security settings must be set to Low. For more information, see High Security Settings Prevent Use of Components. Because the Web Browser control uses the system settings, those settings need to be at their correct levels before the form is launched; they cannot be changed from the form itself.

Instantiating the LitCritC Component

The Install.htm file of the CML/LitCrit application contains this tag:

<OBJECT id=Critique classid=CLSID:DA949BC8-F349-11D2-ABD6-0080C7665CC0 
codeBase=LitCritC.CAB#version=1,0,0,0 WIDTH=0 HEIGHT=0 VIEWASTEXT></OBJECT>

The HTML object tag does not instantiate the object immediately; rather it prepares for the instantiation. This includes checking the registry for the specified classid. If it's not there, Microsoft Internet Explorer automatically attempts to download the .cab file.

Compare the preceding code with the following code, which appears in the beginning of library.asp, which is encountered by users of the CML Web application.

Set objCritique = Application.Createobject("LitCritC.Critique")
If Not Isobject(objCritique) Then
   Set MyControl = MyPage.Controls("WebBrowser1")
       MyControl.Visible = True
       MyControl.Navigate("http:\\" & ServerName & "\Fmlib\LitCritC\Install.htm")
   Item_Open = False
End If

The preceding code also attempts to instantiate the client-side Critique object, but the code it uses to verify the instantiation and respond if it failed is more explicit. This code also uses the Web Browser control. It is not intended that this control be visible, but its methods (such as Navigate) are not available unless the control's Visible property is set to True. However, the control does not appear on the page because its height and width properties are set to 0 pixels each.

The Navigate method points to the Install.htm Web page that downloads the LitCritC.cab file to the browser computer, into the WINNT\ (or Windows\) Downloaded Program Files folder, and then unpacks the .cab file.