Google Analytics

Search This Blog

Sunday, May 11, 2014

COM Interop - ActiveX component can't create object

While performing COM Interop integration, you may encounter the exception 'ActiveX component can't create object' on deployment machine.

It is due to missing class ID (CLSID) in Windows registry which will reference to the library file - i.e DLL file - required by your program.

1.) To find out which CLSID is missing, simulate the process using Process monitor.

http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx



2.) You will find the answer.

For instance, if you get the exception 'Automation error - The system cannot find the file specified'.

Pay attention to the 'NAME NOT FOUND' outcomes under 'Result' column

You will find - based on results from Process Monitor - that even though the respective CLSID entries are found available in the registry, they don't contain the subkey

InprocServer32 which will contain information about the reference to the actual path of the library file.

The solution is to register the library file using regasm using the /codebase switch.

i.e - run the following in command prompt.

regasm /codebase xxx.dll

xxx.dll is the name of your library file.

Good luck programming.

No comments: