• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 233
  • Last Modified:

VB string variable problem

I am receiving information from a C++ dll in VB

the info comes in BSTR strings.. I am receiving 5 variables at once.. everything is the same for all of them

except for 1 of them for some reason its receiving tons of jibberish after the info.. why is that?

when I Msgbox this string variable in VB it only shows the real info.. but when I output it to a log file it shows the jibberish


Here is an example... (Fun) is the real info.. the rest is the jibberish that is added

(Fun) ÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍýýýý
0
bail3yz
Asked:
bail3yz
  • 2
1 Solution
 
käµfm³d 👽Commented:
Perhaps the string is not being properly null-terminated in the c++ DLL?
0
 
bail3yzAuthor Commented:
Heres the system

C++ dll gets info (I dont have full source to this dll) and sends it another C++ dll (i have source) .. this dll sends it to VB

middle dll code is show below

vbFunc2 is a callback function for VB

I do have the code for when tr->name gets filled.. and it looks fine to me.. but I am not very good in C++
I compared it to the other variables that are working good and everything seems the same


HANDLE GetRC(TClientPlayerRecord * tr)
{


	strcpy_s(tempPlayer,200,tr->name);
        CString stringTemp(tempPlayer);
	BSTR temp = stringTemp.AllocSysString(); 
        vbFunc2(temp);
        SysFreeString(temp);
	return 0;
}

Open in new window

0
 
bail3yzAuthor Commented:
Also in VB when I get the length of the variable.. it returns the answer discluding the jibberish
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now