Solved

Unicode in a listview

Posted on 2006-07-08
25
713 Views
Last Modified: 2008-01-09
How do I add add unicode strings to a listview??
0
Comment
Question by:justchat_1
  • 13
  • 11
25 Comments
 
LVL 19

Expert Comment

by:BrianGEFF719
ID: 17067022
Take a look at this article on MSDN:

   How to read and display Unicode String on VB Form
   http://support.microsoft.com/kb/193540/en-us?ln=en-us&sd=gn&fr=0


If you have any specific questions about how that article explains it, please ask.


Brian
0
 
LVL 9

Author Comment

by:justchat_1
ID: 17068602
I cant use forms2.0 because its not distributable...
0
 
LVL 22

Accepted Solution

by:
danaseaman earned 500 total points
ID: 17073593
You can modify the VbAccelerator ListView that comes complete with sourcecode at this link:
http://www.vbaccelerator.com/home/VB/Code/Controls/ListView/article.asp

The instructions on how to modify it to display Unicode are here:
http://www.cyberactivex.com/UnicodeTutorialVb.htm#VbAcceleratorListViewTreeview

The code basically passes the Unicode string as a pointer using StrPtr, the structure must be changed from String to Long, and you must use the Wide API calls.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 9

Author Comment

by:justchat_1
ID: 17075787
I cant get it to work, even the precompiled version is giving me activex errors but im sure they are all installed and registered... (and there are a few references)
0
 
LVL 22

Expert Comment

by:danaseaman
ID: 17076159
Probelm is with SsubTmr6.DLL. If you recompile SsubTmr6.DLL as SsubTmr.DLL it works OK here. Another option is to add the SsubTmr6 source code classes and modules into the project. I use the external DLL for debuging and then once everything is working OK add the subclasser to the control. You can even be clever and have 2 vbg files, one with the DLL and the other with the code added.

You can use Regsvr32.exe to register all this stuff or just browse to it and add them to references. A better reg utility is CCRPRegUtility.exe which even handles Tlb registration.
0
 
LVL 9

Author Comment

by:justchat_1
ID: 17077194
It cant find vbalIml even though it is in the spot it says it cant find it in and correctly registered-gotta love vb...

Any chance you could compile it and send it to me?
0
 
LVL 9

Author Comment

by:justchat_1
ID: 17077200
for 500 points..
0
 
LVL 22

Expert Comment

by:danaseaman
ID: 17078454
0
 
LVL 9

Author Comment

by:justchat_1
ID: 17078518
But those arnt compiled with unicode correct?
0
 
LVL 22

Expert Comment

by:danaseaman
ID: 17078569
Imagelist doesn't need to be Unicode and can be used as is. There is also a class here "ImageList Class Example, VB5 or VB6.zip (57K)" Link http://www.vbaccelerator.com/home/vb/Code/Controls/ImageList/vbAccelerator_Image_List_Control/ImageList_Class_Example__VB5_or_VB6.zip that allows you to use a simple horizontal picture strip (bmp or gif) to ditch the control completely. Once your project is finished you don't need the overhead of the  designer that the full control provides.

Sample usage of this class which I modified to create Imagelist with just one call. imgFlags is a gif placed on the client form with Visible=False:
Private m_cFlg16        As New cImageList 'Country flags
   'Create ImageList from imgFlags.
   m_cFlg16.CreateFromHandle ILC_COLOR8, 23, 17, _
      imgFlags.Picture.Handle, vbMagenta

0
 
LVL 9

Author Comment

by:justchat_1
ID: 17078604
But that doesnt solve my problem...I need the listview-I have a working copy of the image list ocx but I still cant get the program to compile...

Thats why I made an offer for 500 points if you could email me a unicode listview OCX...
0
 
LVL 22

Expert Comment

by:danaseaman
ID: 17078834
0
 
LVL 9

Author Comment

by:justchat_1
ID: 17084236
I get an error "Name conflicts with existing module, project or object library" when I try to add it
0
 
LVL 22

Expert Comment

by:danaseaman
ID: 17086874
Recompiled with new GUID and name. Hopefully this shuld load w/o conflict>
http://www.cyberactivex.com/psc/UniListView.ocx
0
 
LVL 22

Expert Comment

by:danaseaman
ID: 17086914
A quick check to prove Unicode is working in the ListView:

Private Sub Form_Load()
   With UniListView1
      .View = eViewDetails
      .HeaderButtons = True
      .GridLines = True
      .Columns.Add , , "CHS: " & ChrW$(&H6B22) & ChrW$(&H8FCE)
      .ListItems.Add , , "CHS: " & ChrW$(&H6B22) & ChrW$(&H8FCE)
   End With
End Sub
0
 
LVL 9

Author Comment

by:justchat_1
ID: 17086946
Still same error...
0
 
LVL 22

Expert Comment

by:danaseaman
ID: 17087004
Do you have UniToolBox or UniSuite installed. The name may be conflicting with one from one of those products. You can try deinstalling it and/or removing any registry entries that match "UniListView" and then add the above Ocx to new project.
0
 
LVL 9

Author Comment

by:justchat_1
ID: 17087513
removed all registry entries and still no luck-the only references in the project are the standard vb references...does it conflict with any of these?
0
 
LVL 22

Expert Comment

by:danaseaman
ID: 17087570
No. I compiled it on one machine, uploaded, and then downloaded it on another machine and it registered OK here with no conflicts. I do know that the UniToolBox version of LV is called UniListView so I thought that might be the problem.

I did have a similar problem recently where I had a working version of a Unicode version of the VbAccelerator Multicolumn Treeview and then wanted to look at something in the original so I downloaded and compiled the original (non Unicode) version. It made a complete mess of the registry and I could no longer work on my Unicode version. I had to remove everything related including the class registration to get it working again.

Let me go thru this process once again and I'll make up a new Name/GUID to see if that resolves the issue.
0
 
LVL 22

Expert Comment

by:danaseaman
ID: 17087994
Try this one w/ different name and GUID.
http://www.cyberactivex.com/psc/UniListViewU.ocx
0
 
LVL 9

Author Comment

by:justchat_1
ID: 17093443
Tried it on a computer that has never seen the listview before and I got the same error.  It registers correctly but try adding it into a project...
0
 
LVL 22

Expert Comment

by:danaseaman
ID: 17093594
I'm stumped. It works here on both a Win98 box and another with WinXP-SP2. Everything inidicates that there is a conflicting name in the registry. It may not be just the main name of the control but also could be any one of the classes such as:
cColumn.cls
cColumns.cls
cItemGroup.cls
cItemGroups.cls
cListItem.cls
cListItems.cls
cSubItem.cls
cSubItems.cls
cWorkArea.cls
cWorkAreas.cls
pcColumnHeader.cls
pcImageListDrag.cls
pcItemGroup.cls
pcListItem.cls
0
 
LVL 9

Author Comment

by:justchat_1
ID: 17094231
vb6 sp6?
This machine never had the listview control in it im very confused...
0
 
LVL 9

Author Comment

by:justchat_1
ID: 17094337
nevermind...it was a vb problem that it loaded the control twice-its working now

Ill test it out and let you know how it goes...
0
 
LVL 9

Author Comment

by:justchat_1
ID: 17095373
It took a little getting used to but its a very well done control and exactly what I was looking for...THANKS!!!!!
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB 6.0 printer how to align 6 71
VB6 - Convert HH:MM into Decimal 8 70
Add and format columns in vb6 7 70
Set email body to html using vbscript 6 70
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

735 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