views:

123

answers:

1

Howdy,

I have a activex control that I've written using ATL, and am running into a somewhat serious and confusing problem.

when iDispatch::Invoke is called with DISPATCH_PROPERTYPUT/METHOD everything is fine..

when a return a value to javascript/ie after a method call of a VT_BSTR/with a valid BSTR it works fine and has been.

but when I try var stringValue = Object.stringValue which calls iDispatch/Invoke with the DISPATCH_PROPERTYGET flag and i set the return value to VT_BSTR with a valid BSTR (the exact same one i use with the method calls)

I get a permission denied error box in IE..

now when I return various other datatypes (longs.integers.bool's ..etc) to javascript/ie it works fine (with propertyget / method)

i only get permission denied when returning VT_BSTR

any ideas?/tips?

A: 

In your comment above, you're casting c to a BSTR. What is c? If you're not actually calling SysAllocString() to create the BSTR, that could very well be the source of your problem.

Consider using CComBSTR or CComVARIANT to aide you in the process, and also please read Eric's complete guide to BSTR semantics.

jeffamaphone
I've tried SysAllocString in the past for that portion of code, and gave it shot again with the same permission denied error...what a headache yishi've also tried CComVARIANT / CComBSTR with no luck ..
anthony
Can you post a larger part of your code? What you've got there should be fine, but it looks like you're perhaps doing it wrong. Also include your IDL definition.
jeffamaphone
I'll see if i can put up anything more, but for the most part that's all there is...as for the IDL file it's rather simple the methods I'm returning aren't defined in the idl..the methods called with property_method aren't defined in the idl file either and work fine.. (filling out getidsofnames on our own seems to work fine)there's probably something really odd I'm missing and need to keep toying with.
anthony
Yeah, it might be easier if you use MIDL and a standard type library...
jeffamaphone
I'd bet, sadly that's not a something that's possible with this project.plus I assume the issue is in a different potion of the code ... as propertyget, and propertyput do work for not bstr values..I'll update this when i figure something out so the world can be a little less confused.
anthony