Detecting calls from the Function Wizard.

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Detecting calls from the Function Wizard.

Keith A. Lewis
Here is a simple solution:

// Detects if UDF is being called from the function wizard.
template<class X>
inline bool in_function_wizard(void)
{
        return !Excel<X>(xlfGetTool, XOPER<X>(4), XOPER<X>(_T("Standard")), XOPER<X>(1));
}

This uses the library from http://xll.codeplex.com, but you get the idea. No need to enumerate windows like in the Excel SDK example. Enjoy!
Reply | Threaded
Open this post in threaded view
|

Re: Detecting calls from the Function Wizard.

Eric Ehlers-2
Quoting kimosabe <[hidden email]>:

>
> Here is a simple solution:
>
> // Detects if UDF is being called from the function wizard.
> template<class X>
> inline bool in_function_wizard(void)
> {
> return !Excel<X>(xlfGetTool, XOPER<X>(4), XOPER<X>(_T("Standard")),
> XOPER<X>(1));
> }
>
> This uses the library from  http://xll.codeplex.com http://xll.codeplex.com
> , but you get the idea. No need to enumerate windows like in the Excel SDK
> example. Enjoy!

Thank you.  I think that when our code was first written that trick  
must not have been known.  How does it work?

Regards,
Eric

===================================================
Eric Ehlers
nazcatech sprl | Brussels | http://www.nazcatech.be
* Distributed computing for pricing analytics
* Use Microsoft Excel as a client to the Grid


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
QuantLib-dev mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-dev
Reply | Threaded
Open this post in threaded view
|

Re: Detecting calls from the Function Wizard.

Keith A. Lewis
Aucune idée monsieur. I never use it myself, but a lot of people have asked for this functionality.

My unpopular theory is that if you need to use it, then your function is too slow.

Eric Ehlers-2 wrote
Quoting kimosabe <kal@kalx.net>:

>
> Here is a simple solution:
>
> // Detects if UDF is being called from the function wizard.
> template<class X>
> inline bool in_function_wizard(void)
> {
> return !Excel<X>(xlfGetTool, XOPER<X>(4), XOPER<X>(_T("Standard")),
> XOPER<X>(1));
> }
>
> This uses the library from  http://xll.codeplex.com http://xll.codeplex.com
> , but you get the idea. No need to enumerate windows like in the Excel SDK
> example. Enjoy!

Thank you.  I think that when our code was first written that trick  
must not have been known.  How does it work?

Regards,
Eric

===================================================
Eric Ehlers
nazcatech sprl | Brussels | http://www.nazcatech.be
* Distributed computing for pricing analytics
* Use Microsoft Excel as a client to the Grid


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
QuantLib-dev mailing list
QuantLib-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/quantlib-dev