Tutorial :Permission Denied in IE w/ iDispatch DISPATCH_PROPERTYGET


I have an 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 I return a value to the IE javascript, after a method call of a VT_BSTR with a valid BSTR, it works fine.

But when I try:

var stringValue = Object.stringValue;

which calls iDispatch invoked 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.

When I return various other datatypes (longs, integers, bools, ...etc) to the IE javascript, it works fine (with the propertyGet() method). I only get permission denied when returning VT_BSTR.

Any ideas?


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.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »