c++ BSTR to ATL object
Posted on 2001-06-13
I'm trying to send BSTRs to an ATL component from C++.
The BSTR's appear to be created ok from the client, but when watching the incoming BSTRS in the component the debugger reports 'Invalid string format'.
method set up as follows...
in idl file...
[id(3), helpstring("method VerifyUser")] HRESULT VerifyUser([in] BSTR UserID, [in] BSTR Password, [out] VARIANT_BOOL *bCorrect);
in cpp file...
STDMETHODIMP CHMAccounts::VerifyUser(BSTR UserID, BSTR Password, VARIANT_BOOL *bCorrect)
and called from the client...
BSTR x = SysAllocString(wUser); // wchar_t
BSTR y = SysAllocString(wPass);
hr = pHMAI->VerifyUser(x, y, &ok);
Can someone tell me what I'm doing wrong please.