Article View: comp.lang.basic.misc
Article #133Re: Problems displaying Japanese text from a resource DLL
From: Ken Halter
Date: Mon, 18 Mar 2002 02:59
Date: Mon, 18 Mar 2002 02:59
78 lines
4308 bytes
4308 bytes
No help here... but you missed the one group that probably has your answers <g> microsoft.public.win32.programmer.international There's a lot of VB questions / answers there. -- Ken Halter MS-MVP-VB Please keep it in the groups.. "Jeff Lindborg" <jlindborg@home.com> wrote in message news:zc3l8.62698$uA5.62265@rwcrnsc51.ops.asp.att.net... > I've written (what should be) a fairly simple VB 6 application that will > simply display informational text on a form when run. I've generated > different DLLs for each language that we support and at startup I check to > see which language is the system default and then display the text in that > language. No fancy user input issues etc. This works great for all > languages except Japanese (and presumably Chinese when we get to supporting > it). > > The resource DLLs were compiled by taking a simple .RC file (with just a few > dozen strings in it) and compiling it into a .RES file and then linking that > into a DLL. No surprises there. When I open the Japanese resource DLL > using C++ on the Japanese OS the strings in the resource table are displayed > perfectly. When I run my VB app on that same system, the strings pulled > from the DLL are displayed as garbage. > > I've scoured these news postings for a couple days and I thought I'd covered > all the basic rookie missteps here. The fonts/character sets are all set > properly on the form. I'm not trying to get fancy by displaying characters > that are not in my current code page, I'm not trying to display more than > one language at a time etc. I can't figure out for the life of me what I'm > missing. > > Here's the code in question. I would really appreciate any feedback from > folks on what I might be doing wrong here. > > Dim lDLLHandle as long, hr as Long > Dim strBuffer as string, strFileName as string > > strFileName = App.Path + "\resources\JPN\MyRes.dll" > strBuffer = String$(100, vbNullChar) > > lDLLHandle = LoadLibraryExW(StrPtr(strFileName), 0&, > DONT_RESOLVE_DLL_REFERENCES Or LOAD_LIBRARY_AS_DATAFILE) > > hr = LoadStringW(lDLLHandle, lStringID, StrPtr(strBuffer), Len(strBuffer)) > > 'Setup font and character set of control to write the text to. I've tried > removing this > 'and manually setting the fonts on the form itself with the same results. > MyTextBox.Charset = SHIFTJIS_CHARSET > MyTextBox.Name = ChrW(&HFF2D) + ChrW(&HFF33) + ChrW(&H20) + ChrW(&HFF30) + > ChrW(&H30B4) + ChrW(&H30B7) + ChrW(&H30C3) + ChrW(&H30AF) > MyTextBox.Size = 8 > > '1041 is the Japanese language code... > MyTextBox.text=StrConv(strBuffer,vbUnicode,1041) > > Do I need to use MultiByteToWideChar to convert the string? It's my > understanding that the StrConv function will perform the same task. Is > there something else fundamental that I'm missing here? > > Thanks for any help > > -Jeff > Lindborg@AnswerMonkey.net <mailto:Lindborg@AnswerMonkey.net> > > >
Technical Details
Message-ID:
<elXZGjizBHA.2324@tkmsftngp03>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!t-online.de!tkmsftngp01!tkmsftngp03References:
<zc3l8.62698$uA5.62265@rwcrnsc51.ops.asp.att.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10c949,a9f62139f478463c X-Google-Attributes: gid10c949,public X-Google-Thread: 104093,a9f62139f478463c X-Google-Attributes: gid104093,public X-Google-Thread: 11493c,a9f62139f478463c X-Google-Attributes: gid11493c,public X-Google-Thread: 108062,a9f62139f478463c X-Google-Attributes: gid108062,public X-Google-Thread: 100d42,a9f62139f478463c X-Google-Attributes: gid100d42,public X-Google-ArrivalTime: 2002-03-17 19:02:07 PST From: "Ken Halter" <Ken_Halter@Use_Sparingly_Hotmail.com> References: <zc3l8.62698$uA5.62265@rwcrnsc51.ops.asp.att.net> Subject: Re: Problems displaying Japanese text from a resource DLL Date: Sun, 17 Mar 2002 18:59:13 -0800 Lines: 80 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2600.0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Message-ID: <elXZGjizBHA.2324@tkmsftngp03> Newsgroups: comp.lang.basic.misc,cz.comp.lang.basic.visual,microsoft.public.basic.other,microsoft.public.vb.general.discussion,microsoft.public.vb.winapi NNTP-Posting-Host: dsl-65-184-178-73.telocity.com 65.184.178.73 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!t-online.de!tkmsftngp01!tkmsftngp03