JavaScript/C++: Passing a JavaScript String to C++ ActiveX Control
Hey everyone, I'm writing an ActiveX control to embed inside an Internet Explorer page, and I'm having trouble passing a string to an ActiveX method from inside JavaScript.
On the ActiveX side, I'm using C++ to compile and register an OCX, and the syntax for my method looks like this:
VARIANT_BOOL ProcessText(char * TextString)
On the JavaScript side, I call the method like this:
<OBJECT id="TextControl" classid="clsid:F73A5DFD-1117-4485-B486-8ECDF0638736" VIEWASTEXT>
<input name="btnProcess" type="button" value="Process" onclick="document.TextControl.ProcessText("Textblahblah");">
Clicking the Process button gives me a "Type Mismatch" error.
So what do I have to do to make this call work? The ActiveX function works fine if I call it from the ActiveX Test Container. It seems to be some kind of conversion problem between JavaScript and C++.
Thank you for any help.
Re: JavaScript/C++: Passing a JavaScript String to C++ ActiveX Control
Making the variable a LPCTSTR type will work. I have done that.
I have a problem of passing in an array of strings. I have made the parameter a BSTR, VARIANT FAR*. Can anybody help?