Exception raised in adxAddin.TadxFactory.Create

Add-in Express™ Support Service
That's what is more important than anything else

Exception raised in adxAddin.TadxFactory.Create
 
Michel Brazeau




Posts: 17
Joined: 2006-08-31
Hi,

I'm porting an addin for Outlook/Word/Excel to Delphi XE2 64 bit. The existing addin works well in 32 bit. I've got everything compiling without issues.

But when I try to register my DLL, I get the following error as seen here:

[img]https://docs.google.com/open?id=0BztcY8LQKxsYSk9OeXZrY0dKdzA[/img]

I am able to debug fr om the IDE by loading the process,

c:\windows\system32\regsvr32.exe

with my DLL as parameter.

Then I trace to where the TadxFactory is created in my unit initialization,

TadxFactory.Create(ComServer, TEdcMs, CLASS_EdcMs, TAddInModule);

Then inside, TadxFactory.Create, calls,

inherited Create(ComServer, AutoClass, ClassID, ciMultiInstance, tmApartment);

That's when the exception above occurs. I cannot trace into the implementation of System.Win.ComObj.TAutoObjectFactory.Create so I don't know wh ere to look for the cause of this.

Any idea what I can do to troubleshoot this further?

Best regards,

Michel

----

Hi everyone,

I have more information. I traced into Delphi's code and the error is raised in

ComObj.TTypedComObjectFactory.Create

when the call to,

ComServer.TypeLib.GetTypeInfoOfGUID(ClassID, FClassInfo)

This is a COM method and I can no longer trace.

I'm using the same *_TLB.PAS file as in the 32 bit version. From what I understand, class id's are in two completely different databases in Win32 and Win64 and it is ok to keep the same class id's.

I have also removed all the application specific code in the my TadxCOMAddInModule descendant.

I have also tried registering from a command prompt running as administrator, and from Delphi XE2 running as administrator.

Any ideas?

Best regards,

Michel
Posted 14 Jun, 2012 15:21:28 Top
Andrei Smolin


Add-in Express team


Posts: 18794
Joined: 2006-05-11
Hello Michel,

Thank you for the details.

Do you use XE2 Update Pack 4?


Andrei Smolin
Add-in Express Team Leader
Posted 15 Jun, 2012 08:10:08 Top
Michel Brazeau




Posts: 17
Joined: 2006-08-31
Hello Andrei,

Yes, I checked and my install of Delphi XE 2 is very recent with SP4. I just saw the post,

http://www.add-in-express.com/forum/read.php?SHOWALL_1=1&FID=1&TID=10531

Although, in my case, I'm not able to register the DLL.

Can you send me by email the "workaround" for SP4 in system.Win.ComObj.pas?

Thank you very much,

Michel
Posted 15 Jun, 2012 08:18:34 Top
Andrei Smolin


Add-in Express team


Posts: 18794
Joined: 2006-05-11
Hi Michel,

I've just sent it by email.


Andrei Smolin
Add-in Express Team Leader
Posted 15 Jun, 2012 08:37:31 Top
Michel Brazeau




Posts: 17
Joined: 2006-08-31
Hello Andrei,

Thanks for the patch. I copied the modified unit to my project and I'm sure it is being compiled and linked.

But I still get the original error,
https://docs.google.com/open?id=0BztcY8LQKxsYSk9OeXZrY0dKdzA

when I attempt to register the DLL. As I mentioned, I can trace into my *_IMPL.Pas unit initialization,

TadxFactory.Create(ComServer, TEdcMs, CLASS_EdcMs, TAddInModule);

which eventually calls,

ComServer.TypeLib.GetTypeInfoOfGUID(ClassID, FClassInfo)

and that is where the error occurs.

I put a break point on EventDispatchInvoke and it does not get called before the error occurs.

Any help appreciated.

Best regards,

Michel
Posted 15 Jun, 2012 09:18:39 Top
Michel Brazeau




Posts: 17
Joined: 2006-08-31
Hi Andrei,

I'm even more confused. I decided to create a brand new empty ADX COM Add-in from the wizard and with the modified ComObj.Pas.

When I attempt to register from a CMD prompt under administrator, I get the same message,

https://docs.google.com/open?id=0BztcY8LQKxsYSk9OeXZrY0dKdzA

Can I send you the DLL so you can try it out? I'm really out of ideas.

Thanks,

Michel
Posted 15 Jun, 2012 10:30:56 Top
Michel Brazeau




Posts: 17
Joined: 2006-08-31
Hi Andrei,

Sorry for the last post. A brand new project does register properly. I'll keep testing rebuilding my Add-in from the "empty" one.

I'll keep you posted.

Michel
Posted 15 Jun, 2012 10:33:47 Top
Andrei Smolin


Add-in Express team


Posts: 18794
Joined: 2006-05-11
Hi Michel,

Thank you for keeping me informed. I hope the issue is caused by something really simple.


Andrei Smolin
Add-in Express Team Leader
Posted 18 Jun, 2012 05:53:12 Top
Michel Brazeau




Posts: 17
Joined: 2006-08-31
Hi Andrei,

It is somehow related to the TLB file. I'm not familiar enough with COM programming. I'd like to use the same EdcMsAddin_TLB.Pas and EdcMsAddin.TLB for both 64 bit and 32 bit. Is that possible? Ideally, I would like to use the same source code, just two differnt .dpr files (for example, EdcMsAddin64.dpr and EdcMsAddin.dpr).

Thanks again,

Michel
Posted 19 Jun, 2012 14:59:04 Top
Andrei Smolin


Add-in Express team


Posts: 18794
Joined: 2006-05-11
Hi Michel,

Yes, it is possible. Pay attention to the test project you created earlier (or create a new one): by choosing a Target Platform, you build 32bit and 63bit DLLs using the same code and .TLB.

If you still have the original problem, please send us the project to the support email address; please find it in {Add-in Express installation folder}\readme.txt. Make sure that your email contains a link to this topic.


Andrei Smolin
Add-in Express Team Leader
Posted 20 Jun, 2012 05:13:52 Top