• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 762
  • Last Modified:

Unicode in a listview

How do I add add unicode strings to a listview??
0
justchat_1
Asked:
justchat_1
  • 13
  • 11
1 Solution
 
BrianGEFF719Commented:
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
 
justchat_1Author Commented:
I cant use forms2.0 because its not distributable...
0
 
danaseamanCommented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
justchat_1Author Commented:
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
 
danaseamanCommented:
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
 
justchat_1Author Commented:
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
 
justchat_1Author Commented:
for 500 points..
0
 
justchat_1Author Commented:
But those arnt compiled with unicode correct?
0
 
danaseamanCommented:
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
 
justchat_1Author Commented:
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
 
justchat_1Author Commented:
I get an error "Name conflicts with existing module, project or object library" when I try to add it
0
 
danaseamanCommented:
Recompiled with new GUID and name. Hopefully this shuld load w/o conflict>
http://www.cyberactivex.com/psc/UniListView.ocx
0
 
danaseamanCommented:
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
 
justchat_1Author Commented:
Still same error...
0
 
danaseamanCommented:
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
 
justchat_1Author Commented:
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
 
danaseamanCommented:
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
 
danaseamanCommented:
Try this one w/ different name and GUID.
http://www.cyberactivex.com/psc/UniListViewU.ocx
0
 
justchat_1Author Commented:
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
 
danaseamanCommented:
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
 
justchat_1Author Commented:
vb6 sp6?
This machine never had the listview control in it im very confused...
0
 
justchat_1Author Commented:
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
 
justchat_1Author Commented:
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

Industry Leaders: 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!

  • 13
  • 11
Tackle projects and never again get stuck behind a technical roadblock.
Join Now