Re: Help please: Trouble getting a value back from COM.
Darrin Smith <[email protected]>
| Newsgroups | gmane.comp.windows.devel.jawin |
|---|---|
| Message-ID | <LISTSERV%[email protected]> |
I think Jawin has some problems even after the correction.
Here is what I tried:
In the header file:
STDMETHOD(Garbage)(BSTR InputString, int InputInt, BSTR* returnString);
In the cpp file:
STDMETHODIMP CValidateLogin::Garbage(BSTR InputString, int InputInt,BSTR*
returnString)
{
*returnString = CString(_T("blah")).AllocSysString();
return 0;
}
In the idl file:
interface IValidateLogin : IDispatch{
[id(1), helpstring("method ValidateLogin")] HRESULT ValidateLogin
(BSTR UserName, BSTR Password, BSTR Domain, BSTR Server, BSTR* GroupRet);
[id(2), helpstring("method Garbage")] HRESULT Garbage([in]BSTR
InputString, [in]int InputInt, [out]BSTR* returnString);
I then called it like this:
GUID loginGUID = new GUID("{CAAB21D7-C41D-45F9-A610-9ADCAF448161}");
IValidateLogin iLogin = new IValidateLogin(loginGUID);
String[] retArray = new String[20];
iLogin.Garbage("InputString", 5, retArray);
On the last line, it gives me a Type Mismatch error upon execution
(everything compiles of course):
org.jawin.COMException: 80020005: Type mismatch.
at org.jawin.marshal.GenericStub.dispatchInvoke0(Native Method)
at org.jawin.marshal.GenericStub.dispatchInvoke(GenericStub.java:84)
at org.jawin.DispatchPtr.invokeN(DispatchPtr.java:473)
at org.jawin.DispatchPtr.invokeN(DispatchPtr.java:433)
...