Calling RegisterXLL

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

Calling RegisterXLL
RegisterXLL crashing or having no effect 
Mark K




Posts: 85
Joined: 2007-05-29
Hi,

I have a COM plug in that I want to use to register an XLL.

If I call ExcelApplication.RegisterXLL in the AddInInitialize it raises exception $C0000005.

If I call it anywhere else it has no effect. Is there a right way and a wrong way to call this or what am I doing wrong? I have checked the file name being input to the call and it is correct.

Thanks in advance for any help.

Cheers

Mark
Posted 07 Mar, 2012 00:16:39 Top
Andrei Smolin


Add-in Express team


Posts: 14677
Joined: 2006-05-11
Hi Mark,

I remember sucessfully registering an XLL in WindowActivate.

Do you register it to avoid the known issue with Excel UDFs: they are truned off when Excel is run via Automation?

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 07 Mar, 2012 06:33:08 Top
Mark K




Posts: 85
Joined: 2007-05-29
Hi Andrei,

The problem is solved and everything works perfectly!

Without going into the details it was my own code causing all the issues :-)

In any case thanks for your quick response.

Cheers

Mark
Posted 07 Mar, 2012 20:05:21 Top
Mark K




Posts: 85
Joined: 2007-05-29
Hi Andrei,

So everything works fine with the XLL and RegisterXLL works perfectly when I am using the XLOPER4 structures.

Now I start to add the support for XLOPER12 and as soon as my XLL exports 'xlAutoRegister12' the RegisterXLL fails. It doesn't give me any messages it just comes back with a False result.

Is there anyway to find out why the RegisterXLL fails? It has not tried to execute anything in the XLL.

Thanks

Mark
Posted 20 Mar, 2012 04:54:49 Top
Mark K




Posts: 85
Joined: 2007-05-29
I should have added that if I just comment out the xlAutoRegister12 export the XLL has no problems and still works fine so I haven't altered any of the original code to cause the issue. What surprises me is it falls over on the Register without actually executing any of the code in the XLL.

Cheers
Posted 20 Mar, 2012 05:01:16 Top
Andrei Smolin


Add-in Express team


Posts: 14677
Joined: 2006-05-11
Mark,

I assume your XLL add-in is not Add-in Express based. If so, you need to look into Excel 2007 SDK. Pay attention to the sample projects provided. And check HRESULTs in your code.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 20 Mar, 2012 05:55:21 Top
Mark K




Posts: 85
Joined: 2007-05-29
Andrei,

The XLL is Delphi based but not Add-In-Express based. I cannot check any results from any calls because no code is executing in the XLL. It fails during registration. It isn't registering because it is failing in the RegisterXLL called from within the Add-In-Express COM module.

If I remove the export for the 'xlAutoRegister12' function it works perfectly.

My question was whether I could get any feedback from the RegisterXLL call within the COM module as to why it is failing.

Thanks

Mark
Posted 20 Mar, 2012 06:10:07 Top
Andrei Smolin


Add-in Express team


Posts: 14677
Joined: 2006-05-11
On the caller side, you can only use the value returned by RegisterXLL. You need to look into the code which is invoked within the XLL add-in itself.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 20 Mar, 2012 06:33:37 Top
Mark K




Posts: 85
Joined: 2007-05-29
Hi Andrei,

Thanks for the feedback.

Unfortunately I can't check anything in the XLL as it is simply whether or not it exports the function that cause the RegisterXLL to fail. It doesn't execute anything in the XLL or make any calls into it for me to trace it, debug it or get an error message. The RegisterXLL call fails if the xlAutoRegister12 function is exported and it doesn't fail if it isn't. The call is pretty much identical to the xlAutoRegister function (apart from using XLOper12 structures instead of XLOper4) which works perfectly. As the references to the structures are only pointers I am not sure I understand how that is causing it to fail.

I have read on the web that developers can get access to the failure from the RegisterXLL call in other languages. If it possible for me to get that information from within the Add-In-Express call? If I call GetLastError in the add in will it help?

If there is no additional information available from within the Add-In-Express DLL I will see what else I can do to figure it out.

Thanks anyway for your input.

Regards

Mark
Posted 20 Mar, 2012 06:46:27 Top
Andrei Smolin


Add-in Express team


Posts: 14677
Joined: 2006-05-11
Mark,

Exporting the function means Excel will invoke it. And Excel invokes it when you call RegisterXLL. I suppose Excel expects to receive OPER12 type structures but your XLL add-in returns OPER4 structures. To understand the real cause, you need to debug the functions that your XLL provides. All this closely relates to the things described in the Excel 2007 SDK.

Mark K writes:
I have read on the web that developers can get access to the failure from the RegisterXLL call in other languages. If it possible for me to get that information from within the Add-In-Express call? If I call GetLastError in the add in will it help?


Sorry, I just don't know.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 20 Mar, 2012 07:06:58 Top