How To ...
     
Implement Reg Free COM






Solutions Schedule WPF - Gantt style drag and drop multi resource scheduling





Resources


Smart Client

Web Demos



Tech Tips


The Dynamics of
Scheduling white paper



Warehouse Shipment Scheduling o
n YouTube
 


.NET Products

Solutions Schedule



Studio Controls


Extractor



COM Products


Solutions Schedule


Studio Controls


Extractor



Frameworks


Warehouse and Shipment Scheduling




Commercial Software

Staff Scheduler Pro



    Free Trial

 
Interest in our COM products is still very strong, which has led to more questions on the deployment side of things. As such I thought we’d delve into an interesting but often overlooked method of deploying ActiveX controls with applications. It’s called RegFree COM. That’s right, as the name implies it removes the need to RegSvr .ocx files or register them during deployment.

This has an impact especially with the Windows 7 UAC and registry lockdowns across networks. The process is pretty straightforward, you build a .manifest file for your application that contains all the information needed to call your .ocx files.

Here is the breakdown… you will need an IDE that will compile down to an executable in order to attach the manifest. In our sample below we will simply use the method for including the .manifest file with the application.exe, but there are ways to build the manifest into the actual executable. For more information on that do a google on MT.exe and manifest.

Basically you can point the executable you are running to the OLE control you want to use and specify the GUIDS for the TypeLib and Class in the manifest thus eliminating the need to check the registry (you can do a quick google on RegFree COM for more on the background story) and I'll focus on how you can set one up to use some of our controls. As you are going to need both the typelib ID and class ID you may want to trackdown a copy of OLEVIEW. That little tool shipped back with VisualStudio 6 (I think it may actually go back to 4) but you can find a copy here...

http://www.microsoft.com/downloads/details.aspx?familyid=5233b70d-d9b2-4cb5-aeb6-45664be858b6&displaylang=en

So basically let’s start a small sample app for testing purposes... we'll toss ctList on a form there and call our app ctxListTest.exe   Add a couple of node items in the firstdraw and build your app.Now let’s copy our ctxList.ocx to a folderin your app path called bin. We are then going to create a file called ctxListTest.exe.manifest in the same folder as the executable. You can also check out some articles on building the manifests into the executables, here are a couple of command line utilities available from Microsoft that will handle this, but for our example we are going to use the "deploy with executable" method. The XML is going to look like so...


<?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: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="ctxDate.exe" version="1.0.0.0" type="win32" />

  <file name="bin\ctxDate.ocx" asmv2:size="118784">

    <typelib tlbid="{F5A21BA6-2C08-11D5-A85D-0080C8DFC881}" version="6.0" helpdir="" resourceid="0" flags="HASDISKIMAGE"  />

    <comClass clsid="{F5A21BA6-2C08-11D5-A85D-0080C8DFC881}" threadingModel="Apartment" tlbid="{F5A21BA6-2C08-11D5-A85D-0080C8DFC881}" progid="ctxDATE.ctxDateCtrl.6" description="ctxDate Control" />

  </file>

</assembly>

Now you can see we have a single <file> tag in our XML, you can have as many as you need to define for your app. Notice this one is for ctxDate, we are going to mod it for use with ctxList by changing the tag properties as follows...

This info is from the actual exe file properties...

-orig-<assemblyIdentity name="ctxDate.exe" version="1.0.0.0" type="win32" />

-new-<assemblyIdentity name="ctxListTest.exe" version="1.0.0.0" type="win32" />

Now for the OCX part...

-orig-

  <file name="bin\ctxDate.ocx" asmv2:size="118784">

    <typelib tlbid="{F5A21BA6-2C08-11D5-A85D-0080C8DFC881}" version="6.0" helpdir="" resourceid="0" flags="HASDISKIMAGE"  />

    <comClass clsid="{F5A21BA6-2C08-11D5-A85D-0080C8DFC881}" threadingModel="Apartment" tlbid="{F5A21BA6-2C08-11D5-A85D-0080C8DFC881}" progid="ctxDATE.ctxDateCtrl.6" description="ctxDate Control" />

  </file>

-new-

  <file name="bin\ctxList.ocx" asmv2:size="471040">

    <typelib tlbid="{38EC7E50-6A01-4727-88E7-47788ABD54FE}" version="6.0" helpdir="" resourceid="0" flags="HASDISKIMAGE"  />

    <comClass clsid="{2B447B04-4CDC-4F52-915C-694DDCAD79F4}" threadingModel="Apartment" tlbid="{38EC7E50-6A01-4727-88E7-47788ABD54FE}" progid="ctxLIST.ctxListCtrl.6" description="ctxList Control 6.0" />

  </file>

So your XML text for the ctxList will be...

<?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: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="ctxListTest.exe" version="1.0.0.0" type="win32" />

  <file name="bin\ctxList.ocx" asmv2:size="471040">

    <typelib tlbid="{38EC7E50-6A01-4727-88E7-47788ABD54FE}" version="8.0" helpdir="" resourceid="0" flags="HASDISKIMAGE"  />

    <comClass clsid="{2B447B04-4CDC-4F52-915C-694DDCAD79F4}" threadingModel="Apartment" tlbid="{38EC7E50-6A01-4727-88E7-47788ABD54FE}" progid="ctxLIST.ctxListCtrl.8" description="ctxList Control 8.0" />

  </file>

</assembly>

full view

If you wish to test this on your dev machine, you'll have to regsvr32/u ctxList.ocx  (in your Studio Controls for COM install folder) then if you did everything right your app should run as normal, rename the ctxListTest.exe.manifest to something else and run it and you should get a class unregistered error.

As always from all of us here in support, take care and have a great day!

 

      Free Trials
     
       
      all rights reserved  |  copyright © 1996 - 2017   |  Terms of Use
 
      http://www.dbi-tech.com