|
-
May 27th, 1999, 09:24 AM
#1
C++ DLL to return BSTR to VB
I have a function in a DLL (VC++5) that needs to return a BSTR. This DLL uses Automation
The problem I am having is that the string in VB that receives the returned BSTR from the DLL only receives the first character of the string!
here is the DLL function:
BSTR __stdcall MyFunction (void)
{
CString strg;
strg="Hello There!";
return strg.SysAllocString();
}
The VB side of things is obvious:
Declare Function MyFunc Lib "DLLFile" () As String
Dim MyStrg As String
MyString=MyFunc
MsgBox MyString //This Displays an H only, not Hello World!
I believe this has to do with the fact that a BSTR in C++ is an unsigned short*, but I don't know how to resolve this!
Thanks in advance
Jeff
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|