Tuesday, May 29, 2007

VB6 Unicode Tutorial (aka "Ton's O VB6 & Unicode Fun")

CyberActiveX - Tutorial - Using Unicode in Visual Basic 6.0 

"...

Although Visual Basic 6.0 stores strings internally as Unicode(UTF-16) it has several limitations:

  1. * Ships with ANSI only controls (Label, Textbox, etc.).

  2. * Properties Window in IDE is ANSI only. Unicode strings are displayed as '????'

  3. * PropertyBag automatically converts Unicode strings to ANSI.

  4. * Clipboard functions are ANSI only.

  5. ? Menus are ANSI only.

The purpose of this tutorial is to resolve these issues and provide working VB code solutions. The level of difficulty of these solutions vary but in general require intimate knowledge of ActiveX Controls and Classes. Subclassing and API programming are a must to gain functionality that Vb does not directly support.

...    

A coworker sent me this site today. It looks to be an outstanding VB6/Unicode resource. Last having been updated October 4, 2006, you can tell it's actively getting care and feeding.

To help you get a feel for all the great information available, I've reproduced the index below...

Index

01 Introduction 16 Custom Control Example 31 Input Methods 46 Win98
02 Flowchart 17 Unicode Aware Controls 32 Resource Files 47 MapString
03 Character Sets 18 Convert Utf8 - Utf16 33 Satellite DLLs 48 Byte Array
04 SBCS-DBCS 19 Export UTF-8 Example 34 XP Themes 49 IStream
05 Test Strings(Unicode) 20 Export To File 35 Menus 50 Calendars
06 Platforms 21 ClipBoard 36 Database 51 Sorting
07 LocaleLCID 22 Unicode Blocks 37 Grid Controls 52 References
08 Codepage 23 DrawText Align Flags 38 Misc Source Code 53 Links
09 Fonts 24 RTL(RightToLeft, Mirroring) 39 IsUnicode 54 Troubleshooting
10 Uniscribe 25 Hints 40 IdeographicDescChar 55 Final
11 Mlang 26 Why use a Type Library? 41 SurrogatePairs    
12 RichEdit 27 Chinese GB18030 Support 42 DateTime    
13 MSLU 28 PropertyBag 43 FileIO    
14 GDI+ 29 PropertyBag-UTF8 44 VbAccelerator
ListViewTreeview
   
15 User Controls
Owner/Custom Draw
30 Property Pages 45 Registry    

2 comments:

Anonymous said...

Tutorial updated on 10-Nov-2007.
Links:
http://www.cyberactivex.com/unicodetutorialvb.htm
http://www.unisuite.com/unicodetutorialvb.htm

Elroy said...

Here, full unicode support in both design mode and during runtime for VB6.
Complete source code.

OptionButton

Checkbox

Label

CommandButton

File I/O

Clipboard I/O

Other routines for putting Unicode into the caption of any VB control with a hWnd,
including forms.

Just download from here and you're all set:

http://motionlabresources.org/Unicode%20&%20RTF%20for%20VB6.zip