Quote:
> I created a VB cOM dll with parameter list like:
> myMethod(a as String)
> Then I made a pointer to the COM object (used #import from
> the MSKB article), and called the function as from VC like
> this:
> char* xyz = "aaaa";
> ptr->myMethod(abc)
> where abc is a BSTR from SysAllocString(xyz);
> Compile error: SysAllocString' : cannot convert parameter
> 1 from 'const char *' to 'const unsigned short *
> Same sort of error if I put in a CString in the Alloc
> argument.
It's because SysAllocString doesn't want "char" it wants "WCHAR".
Try this:
WCHAR * xyz = L"aaaa";
You might also want to try (not compiled):
CString str( "aaaa" );
ptr->myMethod( str.AllocSysString() );
--
russ.
http://www.gipsysoft.com/articles/winspector/ - FREE Spy++ replacement.
http://www.gipsysoft.com/qhtm/ - FREE HTML display in a small and light DLL
http://www.gipsysoft.com/ZoomPlus/ - Programmers Zoom Utility on Steroids