I'm not sure why it returns a VARIANT, since all it ever contains is either an error or a _Key object, but that is indeed what it returns. To turn that into a _Key, you need to do:

Wineyes::_Key *Temp = NULL;
if ( test.vt == VT_DISPATCH && test.pdispVal ) {
   test.pdispVal->QueryInterface( __uuidof(*Temp), (void **)&Temp );
}

(You should check for errors from QueryInterface, too, but since you weren't doing that in your call to get_Key I didn't do it in my code.)


On 2/8/2012 1:06 PM, Sean Farrow wrote:

Hi:

I'm trying to obtain a Key from a hotkey and have the following c++ snipitt:

                //now obtain a key object to get the key combination.

                VARIANT test;

                Hotkey->get_Key(&test);

                Wineyes::_Key* Temp =(Wineyes::Key*)test;

I am told that there is no suitable conversion function. The documentation states that the Key property of a hotkey returns a key object, but in c++ this is returning a variant. Is the idl incorrect, or am I not doing something I should be?

Help appreciated as always.

Cheers

Sean.


Reply via email to