Using ViewerX ActiveX control without system registration
Posted by Yury Averkiev, Last modified by Yury Averkiev on 07 November 2010 12:27 AM
This KB article discusses the use of the SmartCode ViewerX ActiveX control without the need to register them on the target system.

Prior to Windows XP, an ActiveX control had to be registered on the system before it could be used by an application. This registration creates a few issues among which:

  • Registering a control requires administrative rights on a system.
  • Registering a control affects multiple applications as the same DLL is shared among all applications using the same version of the control (some developers refer to this issue as the DLL hell.)
  • An application that unregisters a control will prevent all other applications from using it.

The solution to these issues is to use side-by-side activation, or registration-free components; a concept that is very similar to what was introduced with .NET.

When side-by-side registration is used, two things happen:

  • scvncctrl.dll can be placed in each application's folder and is not shared with other applications.
  • The ActiveX control is not registered in the system wide registry but each application acts as if it had its own registered component.

Enabling this feature is straight-forward with Visual Studio 2005 or newer. Simply open the "References" panel, right-click on the control that you are using and set the Isolated property to True. When this is done, Visual Studio generates a manifest file that is similar to what is shown below. Note that the manifest has to be in the same folder as your application.

Sample manifest:

<?xml version="1.0" encoding="utf-8"?>
<assembly xsi:schemaLocation="urn:schemas-microsoft-com:asm.v1 assembly.adaptive.xsd" manifestVersion="1.0" 
          xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" 
          xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" xmlns:dsig="http://www.w3.org/2000/09/xmldsig#" 
          xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <assemblyIdentity name="WindowsFormsApplication2.exe" version="1.0.0.0" processorArchitecture="x86" type="win32" />
  <file name="scvncctrl.dll" asmv2:size="3410432">
    <hash xmlns="urn:schemas-microsoft-com:asm.v2">
      <dsig:Transforms>
        <dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
      </dsig:Transforms>
      <dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1" />
      <dsig:DigestValue>XajYMS77zmmOZpx3OfMe3ByRIqk=</dsig:DigestValue>
    </hash>
    <typelib tlbid="{2864468c-765f-4ef3-b8cf-42666c92b545}" version="1.0" helpdir="" resourceid="0" flags="HASDISKIMAGE" />
    <comClass clsid="{62fa83f7-20ec-4d62-ac86-bab705ee1ccd}" threadingModel="Apartment" tlbid="{2864468c-765f-4ef3-b8cf-42666c92b545}" 
              progid="SmartCode.ViewerX.3" description="SmartCode VNC Viewer Control" />
  </file>
</assembly>