ADXXLLModule.HostApplication deprecated?

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

ADXXLLModule.HostApplication deprecated?
 
Henjo van Rees




Posts: 3
Joined: 2018-12-10
I get the following warning:

warning CS0618: 'ADXXLLModule.HostApplication' is obsolete: 'The 'HostApplication' property is deprecated in the current Add-in Express version and will be removed in future releases.

What should I use instead?
Posted 21 Jan, 2019 03:06:59 Top
Andrei Smolin


Add-in Express team


Posts: 16176
Joined: 2006-05-11
Hello Henjo,

We don't recommend using the Excel object model (EOM) in the context of an XLL call. If you need to perform some EOM calls from an XLL, you should let Excel switch out of the XLL call context before you use any of EOM object/properties.

That is, the sequence should be as follows:
- Excel invokes your XLL function,
- you do the XLL-related thing your UDF should do
- then you do something (it should be asynchronous) to let Excel switch out of the XLL call context
- end the XLL call
- when Excel switch out of the XLL call context, you perform your EOM-related stuff

To do the context switch, we use the following sequence:
- your solution includes an XLL module *and* COM Add-in module;
- the XLL UDF calls in the COM add-in module;
- the method called invokes ADXAddinModule.SendMessage() - find significant details in Wait a little;
- the method ends; it returns to the XLL UDF and lets it end, too.

When the ADXAddinModule.OnSendMessage event occurs, the switch is already done: you filter out the message sent by the SendMessage call and do your EOM-related calls.

This technique is used in the sample add-in that we describe in Invoking a COM add-in from an Excel XLL add-in: advanced sample.

We recommend using this approach in XLL add-ins that need to write outside of the caller cell (like the Bloomberg add-in does).

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 21 Jan, 2019 03:53:07 Top