Question

My firebreath plugin project has a wrapper class of an active X control.

One of the method takes a BSTR data type variable as input, but when I try to call the method and pass a BSTR, i get an error.

I have even included the "WTypes.h" header file. But that doesnot seem to fix the problem.

So someone suggest an alternative.

short MakeCall (BSTR sNumber,short * nConnectionId );

The Makecall function calls the Makecall function implemented by the active x control by using these paramters

The error

Error   1   error C2665: 'FB::variant_detail::conversion::convert_variant' : none of the 5 overloads could convert all the argument types   c:\users\research\downloads\firebreath-firebreath-firebreath-1.6.0rc1-15-g411c7fe\firebreath-firebreath-411c7fe\src\scriptingcore\variant.h 842 1   axWrapper

PS: After i searched about the error i find that fire breath doesnot support wide characters i.e uni code. So is there a way to use the unicode data type in firebreath.

Was it helpful?

Solution

That error indicates that you are trying to convert a FB::variant into a BSTR, which is not something that FB::variant knows how to do. Most likely that means that you're trying to use a BSTR as a type in a method you registered on a JSAPIAuto object. JSAPIAuto will automatically convert types, but you have to use types that it understands, and BSTR is not one of them.

Instead, find whatever method is registered as a JSAPI method and change the BSTR to a std::wstring; then convert the wstring into a BSTR. This should work fine.

FireBreath does support unicode; you can use std::wstring for wide characters and std::string types coming from the browser will be UTF8. You can #include "utf8_tools.h" and use FB::utf8_to_wstring and FB::wstring_to_utf8 to convert between them.

Hope this helps

OTHER TIPS

#include <atlbase.h>

should do the trick

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top