Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Problem with COM object registration/Class not registered
#4
The dll must be in QM folder, not in a subfolder. At run time too (in QM or exe folder).

__ComActivator_CreateManifest "PACSWebServiceWrapper.dll" 1

The manifest can be used as a file in QM folder or as a manifest resource in your dll. To add manifest resource in VS 2008: add new manifest (menu Project -> Add new item -> Manifest) and replace its text with text of the manifest generated by __ComActivator_CreateManifest. Then VS adds the manifest to dll resources with resource id 2.

The first sentence in __ComActivator_CreateManifest remarks is incorrect. The function uses regasm.exe from the latest installed .NET version, and it works with dlls created for earlier .NET versions too.

__ComActivator_CreateManifest uses regasm.exe just to extract assembly info, not to register.

Updated help text.
Macro __ComActivator help
Code:
Copy      Help
;Allows this thread to use COM components that are not registered in registry.
;COM object creation functions will use component info from manifest, not from registry.
;Supports COM dlls, ActiveX controls and .NET COM-visible components.
;Minimum system requirements: Windows XP SP2. For .NET components - .NET framework 1.1.

;HOW TO USE
;1. You need a manifest for the dll file. It is an XML file or resource. Contains info about the dll and its COM classes.
;;;;To create manifest, call <help>__ComActivator_CreateManifest</help>, like in the example below. Do it once; also for new versions of the component.
;;;;Or you can create manifest manually, or with other manifest creation tools.
;;;;If you are developing the component, you can add the manifest to resources of your dll file. For example, in Visual Studio 2008, add new manifest (menu Project -> Add new item -> Manifest) and replace its text with text of the manifest file generated by __ComActivator_CreateManifest. Then VS adds the manifest to dll resources with resource id 2.
;;;;Some existing .NET components may already have manifest, usually with resource id 1 or 2.
;2. Call <help>__ComActivator.Activate</help> each time before using the component. See examples below.

;NOTES
;When creating manifest with __ComActivator_CreateManifest:
;;;The component file (dll etc) must be in QM folder. Can be in a subfolder, except with .NET.
;;;The manifest file will be created in QM folder.

;When using the component:
;;;The component file must be in the same folder relative to QM (or exe) as when creating manifest.
;;;The manifest file must be in QM folder or in dll resources.

;A manifest created on one computer can be used on other computers too.
;It works in exe too.

;A thread can use single active manifest at a time. Activating other manifest will deactivate previous manifest.
;If you use several such components in thread, you can create single manifest file for all: pass list of files to __ComActivator_CreateManifest. Not with .NET.
;Or activate and create component 1, then activate and create component 2...

;There is other way of using COM components without registration. Specify dll path with <help "::/_COM/IDP_COM_FUNC.html">_create</help> or in <help "::/User/IDH_DIALOG_EDITOR.html#a15">dialog definition</help>. It's easier, faster and works on all Windows versions. Does not work with .NET COM components and some other components.

;EXAMPLES

;create manifest

__ComActivator_CreateManifest "ComDll.dll" ;;or "ComDllFolder\ComDll.dll" (not with .NET)
;__ComActivator_CreateManifest "file1.dll[]file2.dll[]file3.dll" ;;use this if need single manifest for several COM components (not with .NET)

;________________________

;use component

;add this somewhere before calling _create etc
__ComActivator x.Activate("ComDll.X.manifest") ;;use manifest file
;or
__ComActivator x.Activate("ComDll.dll,2") ;;use manifest resource, resource id 2


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)