Test Creating ActiveX Object using VBScript (.vbs)

This article guides you to verify that the Chilkat ActiveX is installed properly and that it’s possible to create an instance of the object.

Please first read this tutorial to understand basic concepts:  https://chilkatsoft.com/activex_dll_registration_tutorial.asp

Step 1.  Download the 32-bit Chilkat ActiveX from here: https://chilkatsoft.com/downloads_ActiveX.asp
*select the Zip Install (manual registration)
* DO NOT unzip in C:\Windows or C:\Windows\system32.  Never put files in those directories.
* Unzip to any directory in the “C:” drive.  Do NOT unzip to a mapped or network drive (the DLL will NOT be trusted by Windows).

Step 2.  We’ll assume you’re running on a 64-bit Windows computer.  To register the 32-bit ActiveX on 64-bit Windows, run the register_x64.bat script that came with the download.  Double-click on register_x64.bat to run it.  This should register the 32-bit ActiveX DLL to your 32-bit Current User Windows Registry.

Step 3. Next we’ll register the 32-bit ActiveX to the 32-bit Local Machine Windows Registry.  This would be needed for applications that run in IIS, as a Windows Service, or as administrator.   Right-click on register_x64.bat and “Run as administrator“.

Step 4.  Download and register the 64-bit ActiveX from here:
*select the Zip Install (manual registration)
https://chilkatsoft.com/downloads_ActiveX.asp

Step 5. Register the 64-bit ActiveX (not as administrator).   Double-click on the register.bat script that came with the download.  This should register the 64-bit ActiveX DLL to your 64-bit Current User Windows Registry.

Step 6. Next we’ll register the 64-bit ActiveX to the 64-bit Local Machine Windows Registry.  Right-click on register.bat and “Run as administrator“.

Next we’ll verify that the ActiveX can be instantiated from VBScript in each of the above cases.

Step 7.  Create a file named testCreateObject.vbs using a text editor.   Copy the following and save.

set zip = CreateObject("Chilkat_9_5_0.Zip")
MsgBox zip.Version

success = zip.UnlockComponent("test")
MsgBox zip.LastErrorText

Step 8.  In the same directory, create a file named testCreate32.bat.  Copy the following and save.

REM This is the 32-bit cscript.
C:\windows\sysWOW64\cscript testCreateObject.vbs
pause

Step 9.  Open a command prompt in the directory where the .vbs and .bat files you just created are located.  Run testCreate32.bat   You should see two message boxes.  The 1st shows the version.  The 2nd shows the LastErrorText for the call to UnlockComponent.  Notice the line that reads “Architecture: Little-Endian; 32-bit”.  This indicates that you’re running in a 32-bit process that loaded the 32-bit ActiveX.

Step 10.  This time, open an administrative command prompt in the same directory and repeat.   If you don’t know how to open an administrative command prompt, Google it…

Step 11. Create a file named testCreate64.bat.  Copy the following and save.

REM This is the 64-bit cscript.
cscript testCreateObject.vbs
pause

 Step 12.  Using a non-administrative command prompt, run testCreate64.bat    The LastErrorText should contain a line that reads:  “Architecture: Little-Endian; 64-bit”.  This indicates that you’re running in a 64-bit process that loaded the 64-bit ActiveX.

Step 13.  Do the same as Step 12, but with an administrative command prompt.  This verifies that the 64-bit ActiveX was properly registered to the Local Machine registry.

Note: The above steps registered and tested the Chilkat ActiveX in all four possible registries:

  • 32-bit Current User Registry
  • 32-bit Local Machine Registry
  • 64-bit Current User Registry
  • 64-bit Local Machine Registry