japanese code conversion problem

Hello ,
          i have a module which displays a dialog box similar to a the groups dialog in windows XP.

Name                       Description
Administrators          Administrators have complete........

like the above.the module was tested in japan and they have come up with a bug that the description
side of the strings is getting transformed to japanese code conversion
like this:

Name                     Description
Administrators        ..#frfd~*76%er

.now i know this is the unicode issue,but can some one please give suggestions on how to solve my component is in visual basic 6.0.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

What are you using to show your data?  You might want to consider one of the controls in the MS-Forms 2.0 Object Library -- it comes with Office and the ActiveX Control Pad (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaxctrl/html/cpad.asp).  It is a DLL (fm20.dll) that contains some Unicode versions of some controls.

Otherwise, try the Unicode controls at http://www.cyberactivex.com/


software_elicoAuthor Commented:
here objGrp is an object of IADsGroup.

Dim objGrp As IADsGroup
    Dim lstItem As ListItem
    'Reset the list boxex
    mobjCont.Filter = Array("Group")
    Screen.MousePointer = vbHourglass
    For Each objGrp In mobjCont
        Set lstItem = lstGroups.ListItems.Add(, , objGrp.name)
        lstItem.ListSubItems.Add , , objGrp.Description

what i dont understand is the name and Description properties are both BSTR ,then how can the name be displayed correctly and the description have japanese characters.
So the name is displaying as you would expect it to but the description is displaying as a jumble of garbage characters?

Are there Japanese characters in the name field (check in AD).  If not, that's why your name is displayed correctly.  As far as I know, the controls supplied with VB6 do not support Unicode (although VB6 strings are Unicode -- go figure!!)  

If there is even the slightest chance that you will need to display foreign characters, you will have to use the Unicode-capable controls I linked to above...

Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

software_elicoAuthor Commented:
*the controls supplied with VB6 do not support Unicode (although VB6 strings are Unicode -- go figure!!)*

Can i get some more information on the VB6.0 unicode support.

software_elicoAuthor Commented:
        If i download the fm20jpn.dll will it support my application which is in VB 6.0 ,to run in a japanese Windows XP operating system.i will clarify the question...

I have an application in visual basic ,say a simple application like a dialog box with a text box to display my name,the problem is when i enter a few characters in japanese ,they all become question mark characters.so if i can download the above mentioned dll or use strconv function,will it work?
Getting fm20.dll, referencing it in VB6, adding its controls to your VB toolbox and using its text box should work.  Replacing all your existing controls with their Forms 2.0 equivalent should do the trick, yes.  Be aware that some of the properties of the Forms 2.0 controls differ from the existing VB6 ones...

software_elicoAuthor Commented:
    i think i got a unitoolbox and started running my applications.it works fine but now i cannot login to the japanese version of windows xp.
You can't log in to the Japanese version of XP since installing, or despite installing, UniToolbox?

Does the username/password for the Japanese XP contain Japanese symbols?  You may have trouble typing the characters, because of a cope page, or something...?

Just a thought,

software_elicoAuthor Commented:
No japanese symbols.but i think they(japs) found a work around to that.
anyway i just have one last query and then i will PAQ the points to you.I have a string variable
to store  the directory path,i am sending this string to a list box list which is a unicode component.but when i read the directory path into the String variable,which does not support unicode,my characters are garbled.so basically my question is ,how can i read this dir path into a unicode string.thanks

If (lpIDList <> 0) Then
    sBuffer = Space(MAX_PATH)  //sBuffer is a String
    SHGetPathFromIDList lpIDList, sBuffer
    sBuffer = Left(sBuffer, InStr(sBuffer, vbNullChar) - 1)
    Exit Sub
  End If

  For l = 0 To lstSelectedFolder.ListCount - 1

    If (sBuffer = lstSelectedFolder.List(l)) Then
        blnFound = True
        Exit For
    End If

  Next l
    If (blnFound = False) Then
        lstSelectedFolder.AddItem (sBuffer)
Firstly, the string variable _does_ support Unicode (all VB6 strings are stored as 2-bytes-per-character).

Why do you use SHGetPathFromIDList?  What kind of list are you taking the directory path from?

If you are using an API call to get the directory path, chances are that you are not trimming the API-received string of Null characters or spaces, etc.  When the API reads into a string buffer, it keeps all the spaces that were there before and just overwrites the characters it needs to (followed by a Null char).  I imagine you are testing for equality without accounting for this:

     sBuffer  = Space(MAX_PATH)          ->       sBuffer = "                    "
     SHGetPath...                                  ->       sBuffer = "c:\                 "
I also imagine that SHGetPath... would return the length of the received text (if it's like most other string-based API calls).  Therefore, I would read in with a byte array:

     ReDim byBuffer(MAX_PATH * 2) As Byte
     nLength = SHGetPathFromIDList lpIDList, byBuffer(0)
     ReDim Preserve byBuffer(nLength - 1)
     sOutput = StrConv(byBuffer(), vbUnicode)

You'll have to play around with it but it _should_ give you some idea...


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
If it doesn't return the length, you'll have to poll the bytes looking for (two adjacent) null byte(s)...

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.