Solved

Unicode in a listview

Posted on 2006-07-08
25
680 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
 
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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Share codes 68 114
Extract Data and filename Macro 20 99
String manipulation in Visual Basic 7 44
MS Date Picker 64 bit 32 bit issue 12 43
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

705 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

18 Experts available now in Live!

Get 1:1 Help Now