dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Encoding of VB String when passed to DLL

  1. #1
    Join Date
    Jan 2006
    Posts
    384

    Encoding of VB String when passed to DLL

    A VBString (String) is being passed to a C DLL. The signature of the C DLL accepts the VB String as a char * parameter. The VBString is being passed as ByVal.

    What would be the encoding of the string received in the C DLL when the Regional Settings System Locale (in XP) is selected as Japanese and the data being passed from VB in the String is Japanese characters ?

    Can we assume that the String is SJIS encoded in this case ?

    The code is existing legacy code that we are studying.

  2. #2
    Join Date
    Jan 2006
    Location
    Fox Lake, IL
    Posts
    15,007

    Re: Encoding of VB String when passed to DLL

    There are no pointers in VB6, so not all DLLS are accessible.
    David

    CodeGuru Article: Bound Controls are Evil-VB6
    2013 Samples: MS CODE Samples

    CodeGuru Reviewer
    2006 Dell CSP
    2006, 2007 & 2008 MVP Visual Basic
    If your question has been answered satisfactorily, and it has been helpful, then, please, Rate this Post!

  3. #3
    Join Date
    Nov 2003
    Posts
    1,902

    Re: Encoding of VB String when passed to DLL

    >> What would be the encoding of the string received in the C DLL
    http://msdn.microsoft.com/en-us/library/4zey12w5.aspx
    The docs don't say explicitly, but I have to assume that the ANSI string is encoded using the systems ACP (codepage value returned by GetACP() function).

    http://msdn.microsoft.com/en-us/libr...8VS.60%29.aspx
    VB6 doesn't seem to support "charsetmodifier", so my next assumption would be that the default setting for charsetmodifier matches the behavior of VB6 for backwards source compatibility.

    A test run on a PC where the ACP=932 should be able to confirm these assumptions.

    gg

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)