Link to home
Start Free TrialLog in
Avatar of janeb
janeb

asked on

ActiveX Document - Why IE ask 'Open or Save' ?

Hi, I am using some ActiveX Documents on my company's Intranet. However a number of users always have this "Open or Save" dialogbox popping out from IE when they point to the VBDs. I have checked that they already have the neccessary DLLs and OCXs that the VB Setup Wizard has included and at the right version. What else I have missed out ??? HELP or my boss is gonna kill me !!
Avatar of Mirkwood
Mirkwood

You poor thing.. I'll see if I can find the answer
PRB: Launching VB5 ActiveX Documents from Internet Explorer
Last reviewed: August 7, 1998
Article ID: Q168431

----------------------------------------------------------------

The information in this article applies to:
Microsoft Visual Basic Professional and Enterprise Editions for Windows, version 5.0

SYMPTOMS
When browsing to an ActiveX Document using Microsoft Internet Explorer, the document will fail to load the associated VBD file correctly. Instead, Microsoft Internet Explorer will display the following message:

   "Opening:
   <filename> from <URL>

   Some files can contain viruses or otherwise be harmful to your
   computer. It is important to be certain that this file is from a
   trustworthy source.

   What would you like to do with this file?"

The user is presented with a choice of Opening or Saving the VBD file. If the user selects Open, the Open With window is displayed asking which application should launch the file. None of the applications listed, including Microsoft Internet Explorer, will successfully launch the VBD file.


CAUSE
The Setup Wizard for Microsoft Visual Basic 5.0 creates a set of files to be used for Internet download of ActiveX Documents. These files include a cabinet (CAB), VBD, and a hypertext-markup HTM file.

Unfortunately, without changes to the HTM file, an ActiveX Document will not launch correctly when a user browses to the HTM file using Microsoft Internet Explorer 3.x.



RESOLUTION
Below is a sample of an original HTM file created using the Microsoft Visual Basic 5.0 Setup Wizard. Following the example, is another sample that shows a working HTM file.

Example 1 - Original HTM File

   <HTML>
   <OBJECT ID="SampleDoc1"
   CLASSID="CLSID:11111111-1111-1111-1111-111111111111"
   CODEBASE="Project1.CAB#version=1,0,0,0">
   </OBJECT>

   <SCRIPT LANGUAGE="VBScript">
   Sub Window_OnLoad
       Document.Open
       Document.Write "<FRAMESET>"
       Document.Write "<FRAME SRC=""SampleDoc1.VBD"">"
       Document.Write "</FRAMESET>"
       Document.Close
   End Sub
   </SCRIPT>
   </HTML>

Example 2 - Changed HTM File

   <HTML>
   <OBJECT ID="SampleDoc1"
   CLASSID="CLSID:11111111-1111-1111-1111-111111111111"
   CODEBASE="Project1.CAB#version=1,0,0,0">
   </OBJECT>
   <SCRIPT LANGUAGE="VBScript">
   Sub Window_OnLoad
       Location.Replace("SampleDoc1.vbd")
   End Sub
   </SCRIPT>
   </HTML>

The changes to the Window_OnLoad procedure allow the VBD file to be launched successfully, thus the ActiveX Document will initialize and display within Microsoft Internet Explorer.
To convert an HTM file created with Setup Wizard, do the following:


Make a copy of your original HTM file.

Open the Original HTM file into Notepad.

Remove the lines in the Window_OnLoad procedure. Make note of the VBD filename on the third line of the procedure.

Place the following code within the Window_OnLoad procedure:

      Sub Window_OnLoad
          Location.Replace("FILENAME.vbd")
      End Sub

    where "FILENAME.VBD" must be replaced with the name of your VBD
    (including quotation marks).


Save the HTM file.  

********************************************

PRB: IE Reports Unknown Type .VBD for ActiveX Document
Last reviewed: August 7, 1998
Article ID: Q167380
 
 


--------------------------------------------------------------------------------

The information in this article applies to:
Microsoft Visual Basic Professional and Enterprise Editions for Windows, versions 5.0, 6.0
Microsoft Internet Explorer, versions 3.0, 3.01, 3.02, 4.0, 4.01


SYMPTOMS
There are problems with ActiveX Documents that will be used on a web server. The ActiveX Document works fine on the development computer but fails on computers that try to access it over the Internet. The following message sometimes appears:


   "Internet Explorer is opening file of unknown type:
   <Name of Document>.VBD from"

CAUSE
This problem behavior can occur because:


You are using the wrong .VBD file.

You are using an out-dated .VBD file.

The Actxprxy.dll is missing or is not registered properly.

The ActiveX EXE/DLL is not registered properly.

Visual Basic Run-time is not installed or on the path.

The ActiveX Document may not be signed or safe for scripting.

Runtime error in initialization code of ActiveX Document.

Dependent files are not being downloaded.

Other problems that occur.

RESOLUTION

Using the wrong .VBD file:
Use the xxx.vbd that is created for you by the Visual Basic Setup Wizard. The Setup Wizard will create a directory of all the files needed for a successful Internet download. Use the files created by Setup Wizard. Do not mix and match these files from other versions on your machine because you will run compatibility issues.


Using an out-dated .VBD file:
The CLSID must be same in the xxx.vbd, xxx.htm (if used), and xxx.exe files of your ActiveX Document project. CLSIDs getting out of synchronization is one of the most common sources of errors for Visual Basic ActiveX Documents. By default, Visual Basic 5.0 creates a new CLSID (and new registry entries) every time you remake your project. Most likely, you will not want this to occur. To preserve the CLSID across builds, do the following:



    - Select the Project menu and the Project Properties items.


    - Select the component tab and select Binary Compatibility, under
      version compatibility.


    - In the text box below that selection, put the DocObject (the .exe or
      .dll, depending upon the ActiveX Document) file name of your project.
If you didn't set Binary Compatibility and rebuild (or directed SetupWiz to rebuild) the project, Visual Basic generated a new CLSID for the same ProgID. When downloading, if Internet Explorer on the client machine sees it is trying to register a different CLSID for the same ProgID, it will create a conflict.X directory under Occache or "Downloaded Program Files" directory. To avoid this problem of the conflict.X directory being created, you need to set Binary Compatibility on your ActiveX Document project unless the project is not backwards compatible.


The Actxprxy.dll is missing or is not registered properly:
If ActiveX DLL works but ActiveX EXE does not, then actxprxy.dll is probably missing or not registered properly. This file is installed by IE3.0X and should be registered. If not, use regsvr32 to register actxprxy.dll.


ActiveX EXE/DLL is not properly registered:
If your ActiveX Document does not show up if you add the .VBD file to Office Binder by selecting the menu item "Section," then item "Add from File," then there is a registry problem or the DocObject can't instantiate. If you can add the .VBD file to Binder, then the .VBD file has the wrong CLSID. Try recompiling and using the .VBD file that is created.


Visual Basic Run-time is not installed or is not on the path:
Make sure MSVBVM50.DLL is correctly installed on your machine.


The ActiveX Document may not be signed:
Changing the securitys in Internet Explorer may resolve this problem. If your server is not signed, you will need Medial level safety for Internet Explorer 3.x and Low for 4.x and above. Check Internet Explorers Online help for more details.


Run-time error in initialization code of ActiveX Document:
Make sure you do Run-time error checking in your ActiveX Document project. You will have problems if you have a Run-time error in either of the following routines. If a run-time error occurs while in this routines, Internet Explorer will display the above-mentioned error message rather than the actual error message in your code:



    - Private Sub UserDocument_Initialize()


    - Private Sub UserDocument_InitProperties()
It is recommended that you do not use the Initialize event because it can fire multiple times under Internet Explorer. Additionally, when the Initialize event is fired, the document is not fully sited in Internet Explorer. It is recommended that you use the Show event.


Dependent files are not being downloaded.
The inability to download dependent files could also cause this error. Visual Basic provides its core-dependent CAB files on the Visual Basic 5.0 CD-ROM in the tools/cabinets directory. It is important to note that these files are not digitally signed. If users are running IE with High security setting, the files will not be installed on their client machine and the ActiveX Document will not run, yielding the error this article is referring to.

The signed versions of these CAB files are available from the Microsoft Web site specified by default in your Internet Component Download (see the generated .INF file for exact name). You can also download and place these CAB files on your own server. Here is how you can accomplish that:


    - Download the desired CAB file by typing the entire CAB file URL (from
      the .INF file) in the address bar of Internet Explorer. Internet
      Explorer will prompt you to Open or Save the CAB file. Save the CAB
      file on your Web server. NOTE: Do not attempt to change file date,
      time or any other attributes since doing so will invalidate the
      signature.

    - While creating Internet Component Setup, specify that files be
      downloaded from your Web server instead of Microsoft Web site.

Other problems that occur:
A. Set the Internet Explorer security settings to allow the ActiveX


      components to download.
B. Turn on the version number increment in your document project and put


      the version number in a field so it displays on the main form of your
      downloaded page. This way you can see whether your project actually
      downloaded or you are looking at an old version.


      To change the version number for the Active Document project:


      1. Select the Project menu and the Project Properties items.


      2. Select the make tab.


      3. Under "Version Number," update the version number manually or
         choose the "Auto Increment" check box.

   C. Always close and re-open Internet Explorer between component download
      attempts to avoid caching the old page.

   D. For referencing remote objects, use CreateObject for debugging.

   E. Make your ActiveX Doc an EXE rather than a DLL for debugging.

   F. Make sure you are using the latest versions of the controls and DLLs
      that ship with Visual Basic in your ActiveX Document. You should
      use MSFlxGrd.ocx instead of Grid32.ocx.

   G. Files will not be download if there is a copy of that file loaded in
      the system. When you are downloading, make sure you are only running
      Internet Explorer on your system. This will minimize the chances of a
      File being loaded that your ActiveX Document needs to download.

ASKER CERTIFIED SOLUTION
Avatar of Mirkwood
Mirkwood

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of janeb

ASKER

Tried everything but I found that the EXE still refuses to run at the client side. Any idea why??
Not from here, no.