0

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.

Raymond Chen
  • 44,448
  • 11
  • 96
  • 135
Kai
  • 953
  • 6
  • 16
  • 37
  • @Taxilian I guess you could help – Kai Nov 04 '11 at 12:30
  • Could you post the code? – Luchian Grigore Nov 04 '11 at 12:32
  • @Luchian Grigore I added the declaration of the function which uses the BSTR data type – Kai Nov 04 '11 at 12:35
  • You also need need to post the error that you are getting – parapura rajkumar Nov 04 '11 at 12:41
  • "When I try to declare a variable as BSTR in my class I get an error." Please include the failed attempt to declare a BSTR. Also, generate (but do not post) the preprocessor output and verify that the definition of BSTR is included at the global namespace. – Raymond Chen Nov 04 '11 at 12:42
  • @Raymond Chen I added the error. I though the error was firebreath specific.So didnot include it previously – Kai Nov 04 '11 at 12:49
  • That does not look like the type of error associated with a member variable declaration. Please post your attempt to declare a BSTR member variable. (From reading between the lines, I think the error is your attempt to *use* a BSTR variable, not declare it. Specifically, you're trying to pass a BSTR variable to a function that does not accept BSTRs.) – Raymond Chen Nov 04 '11 at 13:39
  • @Raymond Chen That was what i intended. Am not able to use the BSTR variable in firebreath framework. – Kai Nov 04 '11 at 13:47
  • I'm still confused. You say that one of the methods takes a BSTR data type variable as input, yet when you pass a BSTR you get an error. Show us the method you are trying to call, and the code that tries to call it. (You also didn't say whether the method in question is a firebreath method or a method you wrote yourself) I'll try to edit your question to remove the misleading bits. – Raymond Chen Nov 04 '11 at 13:57

2 Answers2

2

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

taxilian
  • 14,229
  • 4
  • 34
  • 73
0
#include <atlbase.h>

should do the trick

AndersK
  • 35,813
  • 6
  • 60
  • 86