Re: Japanese strings get mangled when sent from VB6 to VC++ dll
- From: deveasy <deveasy@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 26 Jul 2007 13:48:07 -0700
Thank you for taking a stab at this.
Note that in the first string, the 2nd and 6th characters are wrong (we get
a rectangle). In the second string, the first three characters are wrong.
The first character comes up a rectangle, while the second and third
characters are incorrect.
ドラマに期待
ド䖁マに期䖁
2nd and 6th characters are wrong
を配布中
䖁腍幅中
Characters 1-3 are wrong
I tried padding the string with vbNullChar as you suggested, but got the
same result.
"Robert Morley" wrote:
I'm no expert on C, but is TCHAR a null-terminated data type? Maybe you.
need to add null's to your string before passing it. If I recall correctly,
BSTR is the equivalent of a VB string, but I may be pointing you in the
wrong direction. Anyway, try padding your string with a couple of
vbNullChar characters and see if that fixes the problem. Not sure why that
would affect the leading character in one string and the trailing character
in another, but it never hurts to give it a shot and see what happens.
Rob
"deveasy" <deveasy@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:5B9B099F-68FB-4124-A809-B6A8D96473E8@xxxxxxxxxxxxxxxx
My VB6 program sends some strings to a VC++ dll. The program works fine
for
English, German et al. But it has problems with *some* Japanese
characters.
Please see two examples below:
Strings input from VB
??????
????
Strings obtained by C++ dll
??????
????
Here is the listing of the VB and C++ code. I'd appreciate any pointers
to
fix this problem.
Thanks,
V.
VB code:
Declare Function DoStuff Lib "Test.dll" (ByVal strName As String) As
Double
Public Function SendToDll(strName As String) As Double
SendToDll = DoStuff(StrConv(strName, vbUnicode))
End Function
C++ code:
Declaration:
double __stdcall DoStuff(TCHAR* name);
Definition:
double __stdcall DoStuff(TCHAR* name)
{
AfxMessageBox(name);
return 1;
}
In the def file, the DoStuff function is exported
- Follow-Ups:
- Re: Japanese strings get mangled when sent from VB6 to VC++ dll
- From: Robert Morley
- Re: Japanese strings get mangled when sent from VB6 to VC++ dll
- References:
- Re: Japanese strings get mangled when sent from VB6 to VC++ dll
- From: Robert Morley
- Re: Japanese strings get mangled when sent from VB6 to VC++ dll
- Prev by Date: Re: Runtime error '401': on one of 5 PCs with app
- Next by Date: Re: Japanese strings get mangled when sent from VB6 to VC++ dll
- Previous by thread: Re: Japanese strings get mangled when sent from VB6 to VC++ dll
- Next by thread: Re: Japanese strings get mangled when sent from VB6 to VC++ dll
- Index(es):
Relevant Pages
|