|
-
August 16th, 2006, 11:57 AM
#1
std::string to BSTR conversion
Hi everybody,
I have a problem, i'm developing a dll in VC++ 6.0, this dll is for a Vb 6.0 app. that looks somenthing like this:
BSTR __stdcall login (BSTR user,BSTR password){
...
...
std::string validuser = functhatreturnstdstring(user,password);
return ((BSTR)validuser);
}
How can I convert/cast the std::string to BSTR??? or how can I manage the returned std::string in Vb?? I try returnin a char*, const char*, but, when i run the Vb app. it fails, and says: the instruction at memory 0x98797 referencing to memory 0x0980808 could not be read, whats wrong??? I also try returning others data types int, short, float and works fine, also returning this strange datatype BSTR that is like a char * works fine, whats wrong with char *??
in my Vb code I have something like this:
Private Declare Function login Lib "C:\juan\telcel\KlientC++\KlientCpp\Debug\KlientCpp.dll" (ByVal x As String, ByVal y As String) As String
Private Sub Command1_Click()
Text3.Text = Str(login(Text1.Text, Text2.Text))
End Sub
please Help me!!
What I need to do in Vb or Vc++ to this thing work???
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
|