Archive: How to invoke a COM interface property


How to invoke a COM interface property
Hi,

I'm trying to manipulate a COM Interface object through NSIS, but ran into a snag. I can instantiate my COM object through CoCreateInstance, and can invoke some of its methods, but one I must use is defined such:

[id(0x0000001e), propget, helpstring("gets the key")]
HRESULT publicKey([out, retval] BSTR* pubKey);
[id(0x0000001e), propput, helpstring("sets the key")]
HRESULT publicKey([in] BSTR pubKey);

Note that they both have the same id, but I need to use the setter, and when I do this:

System::Call '$R1->30(w "someChars")'

There is no failure but the subsequent displayed window is all screwed up (missing text, white areas, etc). If I comment out that call all is OK.

How can I invoke the correct interface method?

Thanks,

Norm


I don't think you can trust that id, you must count the methods by hand (Don't forget about the 3 methods in IUnknown and that the first method is 0 and not 1)

(And there is no way two methods with different number of parameters could have the same index since COM uses stdcall)


Couldn't get it to work, so I ended up writing a small dll that does the work I need, and invoked it from nsis.

Thanks,

Normand