1

I'm facing the following configuration: IE loads c++ activeX (LOADER application that loads c# COM ActiveX (EXECUTOR) that using reflection starts c# UI application (the main application) that uses some legacy c++ COM dlls.

I'm trying to avoid registration of these legacy c++ COM (I want to use manifest). But with no success.

If there is a way to specify manifest for the ActiveX with the "file" section that points to these dlls?

I tried to created manifest for IE with no success, putting Native.manifest in the directory where the legacy located, also - no success.

It seems that XBAP instead of loader and executor should solve the problem. But, any ideas how to solve the problem in the current architecture?

thanks

zaky
  • 11
  • 2

2 Answers2

1

You don't own IE so you shouldn't be creating a manifest for it. If you're going to put COM registration data into a manifest, you're going to have to tell the system to look into that manifest for the registration data. Since you don't control the host application, the way to do that is to use the Activation Context APIs, notably CreateActCtx pointing to the correct manifest, followed by ActivateActCtx on that thread. You can then CoCreateInstance what you wish, and follow it with a DeactivateActCtx/ReleaseActCtx.

The reason why an XBAP might be working for you is that since it's a separate executable, the manifest is automatically activated by the system and tied to your XBAP process on process start. When you're hosting inside IE you have to do more work since you don't control the process.

Eugene Talagrand
  • 2,214
  • 1
  • 14
  • 16
0

If you create your own process and host the web browser control, you can provide a manifest file to your application that contain the COM information. As you suggest, it can contain the entries for each legacy COM component (with the progid and comClass info, etc.). Then, when the javascript loaded in your hosted browser control does a "new ActiveXObject()" call, the registry-less COM (Side-by-Side) loader is activated and it will resolve what it needs to using the manifest file.

You can get to this solution in less than 15 minutes just for a proof of concept: just create a new .net application with the webbrowser control embedded, write the test html page with javascript to create your legacy component and call a method in your COM component and finally create the .manifest file for your exe with the entry of the legacy component. Just set the web browser control property to your test html file. Don't forget to unregistr your COM component and update the exe with your .manifest file.

An example of a FILE manifest entry would be like:

<file name="mycom.dll">
    <typelib tlbid="<YOUR TYPELIB ID>" version="1.0" helpdir="" resourceid="0" flags="HASDISKIMAGE" />
    <comClass clsid="<YOUR COCLASS ID>" threadingModel="Apartment" tlbid="<YOUR TYPELIB ID>" progid="mycom.class.1" description="mycom.class" />
</file>

More information on file manifests can be found here:

http://msdn.microsoft.com/en-us/library/aa375632(v=VS.85).aspx

LowRider2112
  • 136
  • 1
  • 5