Solved

Display UNICODE characters in Listview

Posted on 2010-11-30
6
2,375 Views
Last Modified: 2012-05-10
I have a form in MS Access with a listview control.
Some values I need to display are in unicode, but the listview will not show the characters, just replaces them with question marks.

I've looked at other articles such as:
http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_20252634.html?sfQueryTermInfo=1+10+30+listview+unicod
and tried using SendMessage as in attached code (I call the SendMessage function in form's module at time of populating Listview.)
The function returns 1 - suggesting the listview did receive the message, but still the characters are in ANSI, not unicode.
Listview class is MSComctlLib.ListViewCtrl.2 and Access is running on MS Office 2003/Windows Server 2003.

Any suggestions?
Public Declare Function SendMessage Lib "User32" _
         Alias "SendMessageA" _
         (ByVal hWnd As Long, _
         ByVal wMsg As Long, _
         ByVal wParam As Long, _
         lParam As Long) As Long

Public Const CCM_FIRST = &H2000&
Public Const CCM_SETUNICODEFORMAT = (CCM_FIRST + 5)
Public Const LVM_SETUNICODEFORMAT = CCM_SETUNICODEFORMAT
Public Const CCM_GETUNICODEFORMAT = (CCM_FIRST + 6)
Public Const LVM_GETUNICODEFORMAT = CCM_GETUNICODEFORMAT

Call SendMessage(ListView1.hWnd, LVM_SETUNICODEFORMAT, 1, ByVal CLng(0))

Open in new window

0
Comment
Question by:Billy_London
  • 4
6 Comments
 
LVL 9

Expert Comment

by:Ramanhp
ID: 34238263
0
 
LVL 3

Author Comment

by:Billy_London
ID: 34238278
Hi
I've seen that article. It doesn't help. I can display the unicode string in a text box, but the listview activex control will not display unicode.
It's used to list file names; when user double-clicks, then it will launch that file. Once the listview receives the unicode string, it converts it to plain ANSI.
0
 
LVL 10

Expert Comment

by:borgunit
ID: 34239274
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 3

Author Comment

by:Billy_London
ID: 34239308
Hi
yes, I also saw that. It tends to contradict documentation on Microsoft's technet site; if it cannot display unicode, why would they document the LVM_SETUNICODEFORMAT parameter in the first place?
Even if it were true that I'm at a dead end with Microsoft's control, I'm a bit reluctant to roll out other ActiveX controls. The Access db is used on several different platforms (including 32 and 64 bit) and using non-standard controls can add another layer of administration - not withstanding any licensing issues as this is a business application.
thanks
0
 
LVL 3

Accepted Solution

by:
Billy_London earned 0 total points
ID: 34257262
following worked for me, as advised by Chinese colleague:

regional and langage setting => set the Language for non-Unicode programs to 'Chinese (PRC)'
0
 
LVL 3

Author Closing Comment

by:Billy_London
ID: 34289788
on Windows 7:
go to Control Panel - Region and Languages - Administrative tab - change system locale
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now