Quantcast
Channel: VBForums - CodeBank - Visual Basic 6 and earlier
Viewing all articles
Browse latest Browse all 1448

[VB6] Reg-Free COM at runtime via Microsoft.Windows.ActCtx

$
0
0
One of the slick things Microsoft developed before they pulled the plug on VB development and threw everything behind .Net was registration-free COM. Sadly, the change in direction meant that they never added tools support to VB, either in a service pack, an add-on package, or a non-"managed" VB7.

Most of this didn't see the light of day until Windows XP, though it was a bit flaky until XP SP2, and a little less so in XP SP3. But it wasn't really completed until Windows Server 2003 and then in Windows Vista and beyond.

The missing piece was the Microsoft.Windows.ActCtx object.

This never shipped in Windows XP, though at one time there was supposedly a redist Installer merge module for it. I've never seen it though and if it did exist it doesn't seem to be hosted at Microsoft Downloads anymore.


Vista and Beyond

The good news is that we do have it now. So in addition to application manifests for "normal" reg-free COM we can also use "runtime" reg-free COM in VB6 as well as 32-bit VBA and VBScript.

There is one snag: the tooling.


Tools

To create instances of classes from an unregistered DLL requires information from somewhere. The Windows answer to this is application and assembly manifests. However nothing was provided for VB6 developers except for hacks using older versions of Visual Studio .Net or the MT.exe utility from the Windows Vista and later SDKs.

There certainly are 3rd party tools out there. The famous MMM comes to mind as well as the knock-off UMMM and the commercial Side-by-Side Manifest Maker.

However as far as I know only the latter of those can make the assembly manifest files we need for use with the Microsoft.Windows.ActCtx object.


DLLAsm

With that in mind, I knocked together a quick and dirty tool for just this task.

You can run DLLAsm.exe from a command prompt and supply the name of the DLL you need a manifest for, or you can drag the DLL's icon and drop it on the DLLAsm.exe icon in Explorer.

This creates an assembly manifest "next to" the DLL (in whatever folder it is in), overwriting an existing one if any.

Just open the Project in the attached archive and compile it. All of its dependencies are standard libraries included in Windows. While useless on XP it should still compile and run there just fine.
Attached Files

Viewing all articles
Browse latest Browse all 1448

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>