为什么打开吃鸡提示绝地逃生0×00007fffec29ff7fb该内存不能为written

Tutorial - Using Unicode in Visual Basic 6.0 - Free Unicode Controls
Tutorial Using Unicode in
Visual Basic 6.0 Updated
20-October-
Single Developer
(Advanced)
Wizard ***
ASM subclass. Includes 6
Windowless Controls.
US$ 374.62
(Intermediate)
Wizard ***
ASM subclass. Includes 5
Windowless Controls.
US$ 262.06
(Beginner)
ASM subclass. Includes 4
Windowless Controls
Copyright & 2003 - 2017
Dana Seaman -
Unicode and the Unicode Logo are
trademarks of Unicode, Inc.Microsoft and Visual Basic are trademarks
of Microsoft Corporation
This is a work in progress so expect to see updates often.
Send comments, suggestions, corrections, or&
10-May-2017
06-Jun-2017
&04-Oct-2017&
04-Oct-2017
15-Sep-2017
04-Oct-2017
19-Oct-2017
25-Sep-2017
Although Visual Basic 6.0 stores strings internally as
Unicode(UTF-16) it has several limitations:
Ships with ANSI only controls (Label, Textbox, etc.).
Properties Window in IDE is ANSI only. Unicode strings are displayed as '????'
PropertyBag automatically converts Unicode strings to ANSI.
Clipboard functions are ANSI only.
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.
The amount of information gathered during development of Unicode
aware controls was so overwhelming that it made sense to organize it and this
Tutorial proved to be an ideal place to bring eveything together under one roof.
Tutorial Development Tools
Microsoft& Frontpage& 2003
Microsoft& Platform SDK
Feb 2007 Edition for Vista
Visual Basic 6.0 - Service Pack 6
It is highly recommended that you use
the Latest Vb6 runtime libraries.
Release Date: 29-Mar-2004
Size: 1,039.8 Kb
Note: Dates in this tutorial are displayed as dd-mmm-yyyy
(Example: 11-Mar-2004) to eliminate any ambiguities in other Locales.
*& These issues are resolved in Vb.Net although you
will have to go through a learning curve to get up to speed with the language.
&&& Review these tables to determine the
minimum system requirements:
This flowchart shows basic program flow of:
Send ANSI/DBCS text to ANSI Controls or ANSI API.
Send Unicode text to Unicode Controls
Send Unicode text to ANSI/Unicode API using MSLU.
Convert UTF8 to Unicode.
Convert ANSI/DBCS to Unicode.
Get Charset/Codepage from LCID.
Character Set
437 OEM - United States
ANSI (Windows)
1252 ANSI - Latin I
EBCDIC (Mainframe)
1047 IBM EBCDIC - Latin 1/Open System
Unicode Hex
Unicode Dec
UTF-16LE (little endian, low byte
first, x86 Processor and Microsoft Windows)
0..65535(FFFF) - 2 bytes
UTF-16BE (big endian, high byte
first, PowerPC Processor and Mac OS)
0..65535(FFFF) - 2 bytes
UTF-32LE (little endian, low byte
0..10FFFF - 4 bytes
FF FE 00 00
UTF-32BE (big endian, high byte
0..10FFFF - 4 bytes
00 00 FE FF
- Double-Byte Character Set
0..65535(FFFF) - 2 bytes
Chars 0-127 are 1 byte
Note: You should have a utility on your system called
CharMap.Exe which will allow you to browse and select Unicode characters.
SBCS(Single-Byte) and DBCS(Double-Byte) Character Sets&are different character sets from Unicode.
Character codes for &A& in
ANSI, Unicode, and DBCS
ANSI Character &A&
Unicode character &A&
DBCS character that represents a
Japanese wide-width &A&
Unicode wide-width &A&
CharSet from Platform SDK
Font Character Sets
ANSI_CHARSET
West, Occidental(United States, Western Europe)
DEFAULT_CHARSET
SYMBOL_CHARSET
Standard symbol charset
MAC_CHARSET
SHIFTJIS_CHARSET
Shift-JIS (Japanese Industry Standard)
HANGEUL_CHARSET
Korea (Wansung)
HANGUL_CHARSET
Korea (Wansung)
JOHAB_CHARSET
Korea (Johab)
GB2312_CHARSET
Simplified Chinese - Mainland China(PRC) and Singapore
CHINESEBIG5_CHARSET
Traditional Chinese - Taiwan and Hong Kong
GREEK_CHARSET
TURKISH_CHARSET
VIETNAMESE_CHARSET
Vietnamese
HEBREW_CHARSET
ARABIC_CHARSET
BALTIC_CHARSET
RUSSIAN_CHARSET
Cyrillic - Russia, Belarus, Ukraine and some other slavic countries.
THAI_CHARSET
EASTEUROPE_CHARSET
OEM_CHARSET
DBCS - Double-Byte Character Set
DBCS is actually not the correct terminology for
what Windows uses. It is actually MBCS where a character can be 1 or 2 bytes.
To illustrate this consider the following code which will take a Unicode string
of English and Chinese characters, convert to a byte array of MBCS Chinese, dump
the byte array to the immediate window, and finally convert it back to a Unicode
string to display in a Unicode aware textbox. The byte array when converted
using Chinese(PRC) LCID = 2052 contains single bytes for the english characters
and double bytes for the Unicode characters. This proves that it is MBCS and not
Option Explicit
Private Sub Form_Load()
&& Dim sUni As String
&& Dim sMBCS As String
&& Dim b() As Byte
&& Dim i As Long
&& sUni = &2006& & ChrW$(&H6B22) & &9& & ChrW$(&H8FCE) &
ChrW$(&H6B22) & & 8:04&
&& UniTextBoxEx1 = sUni
&& b = StrConv(sUni, vbFromUnicode, 2052)
&& sMBCS = StrConv(sUni, vbFromUnicode, 2052)
&& Debug.Print sUni, sMBCS
&& Text1 = sMBCS
&& For i = 0 To UBound(b)
&&&&& Debug.Print b(i)
&& sUni = StrConv(b, vbUnicode, 2052)
&& UniTextBoxEx2 = sUni
UniTextBox1, UniTextBox2:
;9ƪ 8:04
Debug Window:
182 ' 欢
173 ' 迎
182 ' 欢
32 ' space
The following demos shows how to display
Chinese on an English-U.S. system without changing your Regional settings&
Example of VbTextBox using DBCS
Charset 134, CHINESE_GB2312
Set your TextBox to any Font that supports script CHINESE_GB2312
(Listview1.Font.Charset=134). Example &Arial Unicode MS&. Make sure you select
the CHINESE_GB2312 script from the Font Dialog box.
Add this DBCS string:
TextBox1 =&&CHS: &&&A&&O&&&A&A&U¹&&O&U&I&A&¾&&&OÐ&E¹&O&A&³¾&&I¼&AE&&&&
Warning: If you apply an XP Theme to the TextBox below
via an IDE Manifest it will display ANSI instead of DBCS.
Example of Vb ListView
using DBCS Charset 134, CHINESE_GB2312
Set your Listiew to any Font that supports script CHINESE_GB2312
(Listview1.Font.Charset=134). Example &Arial Unicode MS&. Make sure you select
the CHINESE_GB2312 script from the Font Dialog box.
In report mode add this DBCS string:
ListItems.Add , , &CHS: &&&A&&O&&&A&A&U¹&&O&U&I&A&¾&&&OÐ&E¹&O&A&³¾&&I¼&AE&&&&
See MSDN for more information about DBCS:
DBCS String Conversion
StrConv Function
The global options of the StrConv function are converting uppercase to
lowercase, and vice versa. In addition to those options, the function has
several DBCS-specific options. For example, you can convert narrow letters to
wide letters by specifying vbWide in the second argument of this function. You
can convert one character type to another, such as hiragana to katakana in
Japanese. StrConv enables you to specify a LocaleID for the string, if different
than the system's LocaleID.
You can also use the StrConv function to convert Unicode characters to
ANSI/DBCS characters, and vice versa. Usually, a string in Visual Basic consists
of Unicode characters. When you need to handle strings in ANSI/DBCS (for
example, to calculate the number of bytes in a string before writing the string
into a file), you can use this functionality of the StrConv function.
The easiest way to add Unicode test strings to your project is
to make a resource file with a Unicode aware editor and compile it with RC.exe.
That way you can test your controls without having to cut/paste the strings when
you need them.
Use Notepad if you are on NT or later, WordPad or UltraEdit if using Win9x.
Download the complete resource file with source
&Welcome& in several languages
&Welcome& UTF-16 Unicode
UTF-8 Encoded
&ARA: مـرحبــاً&
&ARA: &U…&U€&O&&O&&O&&U€&U€&O&&U‹&
&CHS: 欢迎&
&CHS: &&&&&Ž&
&CHT: 歡迎&
&CHT: &&&&&Ž&
&ENG: Welcome&
&ENG: Welcome&
&GEO: სასურველი&
&GEO: &ƒ&&ƒ&ƒ&&ƒ&&ƒ&&ƒ•&ƒ”&ƒš&ƒ˜&
&GRK: Καλώς ήλθατε&
&GRK: &Iš&I&&I&&IŽ&I‚ &I&&I&&I&&I&&I„&I&&
&HEB: בִּרוּבִים חַבָּאִים&
&HEB: &‘&&&•&›&™&? &”&‘&?&™&?&
&HIN: रवागत&
&HIN: &&&&&&&&¾&&—&&&&
&JPN: よろてそ&
&JPN: &‚ˆ&?†&?“&??&
&KOR: 여보세요&
&KOR: &—&&³&&„&&š”&
&PAN: ਜੀ ਆਇਆਂ ਨੂੰ&
&PAN: &&œ&&€ &&†&&‡&&†&&‚ &&&&&‚&&&&
&PTB: Bem-vindo&
&PTB: Bem-vindo&
&RUS: Добро пожаловать&
&RUS: ДоÐ&&N€Ð¾ Ð&оÐ&Ð&Ð&овÐ&&N‚&NŒ&
&TAM: அங்கிகரி&
&TAM: &&…&&™&&?&&•&&&&&•&&&&&&&
&THA: การต้อนรับ&
&THA: &&&&²&&&&&•&¹‰&&&&&™&&&&&&&&š&
&URD: स्वागत&
&URD: &&&&&&&&&&¾&&—&&&&
&VIE: t&nh từ&
&VIE: t&A&nh t&&&&
&Hello& in several languages
* Needs Code2000 Font to see this
&Hello& UTF-16 Unicode
UTF-8 Encoded
السلام عليكم
&O&&U„&O³&U„&O&&U… &O¹&U„&UŠ&Uƒ&U…
Bengali (বাঙ্লা)
ষাগতোম
&&&&&¾&&—&&&&&‹&&&
မ္ရန္မာ
(&€™&€¹&€›&€”&€¹&€™&€&)
Cantonese (粵語,廣東話)
早晨, 你好
&&—&&™&, &½&&&½
* Cherokee (&&&Ž³&Ž&)ᎣᏏᏲ
ᎣᏏᏲ
&Ž&&&²
Chinese (中文,普通话,汉语)
你好
&½&&&½
Czech (česky)
Dobr&A½ den
Danish (Dansk)
Hej, Goddag
Hej, Goddag
Tere, Tervist
Tere, Tervist
Finnish (Suomi)
French (Fran&ais)
Bonjour, Salut
Bonjour, Salut
German (Deutsch Nord)
German (Deutsch S&d)
Gr&A¼&AŸ Gott
Georgian (ქართველი)
გამარჯობა
&ƒ’&ƒ&ƒ›&ƒ&ƒ&&ƒ&&ƒ&ƒ‘&ƒ
(ગુજરાતિ)
(&&—&&&&œ&&&&&¾&&&&&&)
Greek (Ελληνικά)
Γειά σας
&I“&I&&I¹&I& &Iƒ&I&&I‚
שלום
&&&œ&•&
नमस्ते, नमस्कार।
&&&&&&&&&&&&&&&&‡, &&&&&&&&&&&&&•&&¾&&&&&&
Ciao, Buon giorno
Ciao, Buon giorno
Japanese (日本語)
こんにちは, コンニチハ
&“&‚“&&&&&&, &½&&¾&¾†&¾&¾Š
Korean (한글)
안녕하세요, 안녕하십니까
&•ˆ&…•&•˜&„&&š”, &•ˆ&…•&•˜&‹&&‹ˆ&¹Œ
Ċaw, Saħħa
&AŠaw, Sa&A&&A&a
Nederlands (Vlaams)
Hallo, Dag Hallo, Dag
Hallo, Dag Hallo, Dag&&&&
Norwegian (Norsk)
Hei, God dag
Hei, God dag
(ਪੁਂਜਾਬਿ)
(&&&&&&&‚&&œ&&¾&&&&&&)
Dzień dobry, Hej
Dzie&A„ dobry, Hej
Russian (Русский)
Здравствуйте!
ЗÐ&&N€Ð&в&N&N‚в&NƒÐ¹&N‚Ð&!
Dobr& deň
Dobr&A½ de&Aˆ
Spanish (Espa&ol)
‎&Hola!‎
&€Ž&A&Hola!&€Ž
Swedish (Svenska)
Hej, Goddag
Hej, Goddag
Thai (ภาษาไทย)
สวัสดีครับ, สวัสดีค่ะ
&&&&&&&&&&&&&&”&&&&&„&&&&&&&&š, &&&&&&&&&&&&&&”&&&&&„&¹ˆ&&&
Tamil (தமிழ்)
வணக்கம்
&&&&&&&&•&&&&•&&&&&
Turkish (T&rk&e)
Vietnamese (Tiếng Việt)
Xin Ch&A&o
Yiddish &€(ײַדישע)
דאָס הײַזעלע
&“&&O&&& &”&²&O&&–&&&œ&&
Other methods for creating a string at Vb Runtime:
Sample Output
ARA: مـرحب
&ARA: & & ChrW$(&H645) & ChrW$(&H640) & ChrW$(&H631) &
ChrW$(&H62D) & ChrW$(&H628)
ARM: ԱԲԳԴԵԶԷԸԹ
&ARM: & & ChrW$(&H531) & ChrW$(&H532) & ChrW$(&H533) &
ChrW$(&H534) & ChrW$(&H535) & ChrW$(&H536) & ChrW$(&H537) & ChrW$(&H538) &
ChrW$(&H539)
CHS: 欢迎
&CHS: & & ChrW$(&H6B22) & ChrW$(&H8FCE)
CHT: 歡迎
&CHT: & & ChrW$(&H6B61) & ChrW$(&H8FCE)
ENG: Welcome
&ENG: Welcome&
GEO: სასურველი
&GEO: & & ChrW$(&H10E1) & ChrW$(&H10D0) & ChrW$(&H10E1) &
ChrW$(&H10E3) & ChrW$(&H10E0) & ChrW$(&H10D5) & ChrW$(&H10D4) & ChrW$(&H10DA) &
ChrW$(&H10D8)
GRK: Καλώς ήλθατε
&GRK: & & ChrW$(&H39A) & ChrW$(&H3B1) & ChrW$(&H3BB) &
ChrW$(&H3CE) & ChrW$(&H3C2) & & & & ChrW$(&H3AE) & ChrW$(&H3BB) & ChrW$(&H3B8) &
ChrW$(&H3B1) & ChrW$(&H3C4) & ChrW$(&H3B5)
HEB: ברוכים הבאים
&HEB: & & ChrW$(&H5D1) & ChrW$(&H5E8) & ChrW$(&H5D5) &
ChrW$(&H5DB) & ChrW$(&H5D9) & ChrW$(&H5DD) & & & & ChrW$(&H5D4) & ChrW$(&H5D1) &
ChrW$(&H5D0) & ChrW$(&H5D9) & ChrW$(&H5DD)
HIN: रवागत
&HIN: & & ChrW$(&H930) & ChrW$(&H935) & ChrW$(&H93E) &
ChrW$(&H917) & ChrW$(&H924)
JPN: ようこそ
&JPN: & & ChrW$(&H3088) & ChrW$(&H3046) & ChrW$(&H3053) &
ChrW$(&H305D)
KOR: 여보세요
&KOR: & & ChrW$(&HC5EC) & ChrW$(&HBCF4) & ChrW$(&HC138) &
ChrW$(&HC694)
PAN: ਜੀ ਆਇਆਂ ਨੂੰ
&PAN: & & ChrW$(&HA1C) & ChrW$(&HA40) & & & & ChrW$(&HA06) &
ChrW$(&HA07) & ChrW$(&HA06) & ChrW$(&HA02) & & & & ChrW$(&HA28) & ChrW$(&HA42) &
ChrW$(&HA70)
PTB: Bem-vindo
&PTB: Bem-vindo&
RUS: Добро пожаловать
&RUS: & & ChrW$(&H414) & ChrW$(&H43E) & ChrW$(&H431) &
ChrW$(&H440) & ChrW$(&H43E) & & & & ChrW$(&H43F) & ChrW$(&H43E) & ChrW$(&H436) &
ChrW$(&H430) & ChrW$(&H43B) & ChrW$(&H43E) & ChrW$(&H432) & ChrW$(&H430) &
ChrW$(&H442) & ChrW$(&H44C)
TAM: அங்கிகரி
&TAM: & & ChrW$(&HB85) & ChrW$(&HB99) & ChrW$(&HBCD) &
ChrW$(&HB95) & ChrW$(&HBBF) & ChrW$(&HB95) & ChrW$(&HBB0) & ChrW$(&HBBF)
THA: การต้อนรับ
&THA: & & ChrW$(&HE01) & ChrW$(&HE32) & ChrW$(&HE23) &
ChrW$(&HE15) & ChrW$(&HE49) & ChrW$(&HE2D) & ChrW$(&HE19) & ChrW$(&HE23) &
ChrW$(&HE31) & ChrW$(&HE1A)
URD: स्वागत
&URD: & & ChrW$(&H938) & ChrW$(&H94D) & ChrW$(&H935) &
ChrW$(&H93E) & ChrW$(&H917) & ChrW$(&H924)
VIE: t&nh từ
&VIE: t&nh t& & ChrW$(&H1EEB)
Note: Under the hood StrConv inserts a BOM (FEFF) before the CJK
Unified Ideographs.
More stuff to play with:
Font.Charset
ANSI_CHARSET
rom&neşte
EASTEUROPE_CHARSET
ChrW$(114) & ChrW$(111) & ChrW$(109) & ChrW$(226) & ChrW$(110) & ChrW$(101)
& ChrW$(351) & ChrW$(116) & ChrW$(101)
ภาษาไทย
THAI_CHARSET
ChrW$(3616) & ChrW$(3634) & ChrW$(3625) & ChrW$(3634) & ChrW$(3652) &
ChrW$(3607) & ChrW$(3618)
Հայերեն
Arial Unicode MS
ChrW$(1344) & ChrW$(1377) & ChrW$(1397) & ChrW$(1381) & ChrW$(1408) &
ChrW$(1381) & ChrW$(1398)
Ti&́ng Vi&̣t
VIETNAMESE_CHARSET
ChrW$(84) & ChrW$(105) & ChrW$(234) & ChrW$(769) & ChrW$(110) & ChrW$(103) &
ChrW$(32) & ChrW$(86) & ChrW$(105) & ChrW$(234) & ChrW$(803) & ChrW$(116)
עברית
HEBREW_CHARSET
ChrW$(1506) & ChrW$(1489) & ChrW$(1512) & ChrW$(1497) & ChrW$(1514)
मराठी
Arial Unicode MS
ChrW$(2350) & ChrW$(2352) & ChrW$(2366) & ChrW$(2336) & ChrW$(2368)
中文 (台灣)
CHINESEBIG5_CHARSET
ChrW$(20013) & ChrW$(25991) & & (& & ChrW$(21488) & ChrW$(28771) &
नेपाली
Arial Unicode MS
ChrW$(2344) & ChrW$(2375) & ChrW$(2346) & ChrW$(2366) & ChrW$(2354) &
ChrW$(2368)
Русский
RUSSIAN_CHARSET
ChrW$(1056) & ChrW$(1091) & ChrW$(1089) & ChrW$(1089) & ChrW$(1082) &
ChrW$(1080) & ChrW$(1081)
ირუკსაბ
Arial Unicode MS
StrReverse(ChrW$(4305) & ChrW$(4304) & ChrW$(4321) & ChrW$(4313) &
ChrW$(4323) & ChrW$(4320) & ChrW$(4312))
日本語
Arial Unicode MS
SHIFTJIS_CHARSET
ChrW$(26085) & ChrW$(26412) & ChrW$(-30050)
ଉଡିଯା
Arial Unicode MS
ChrW$(2825) & ChrW$(2849) & ChrW$(2879) & ChrW$(2863) & ChrW$(2878)
Ελληνικά
GREEK_CHARSET
ChrW$(917) & ChrW$(955) & ChrW$(955) & ChrW$(951) & ChrW$(957) & ChrW$(953)
& ChrW$(954) & ChrW$(940)
हिन्दी
Arial Unicode MS
ChrW$(2361) & ChrW$(2367) & ChrW$(2344) & ChrW$(2381) & ChrW$(2342) &
ChrW$(2368)
한국어
HANGEUL_CHARSET
ChrW$(-10916) & ChrW$(-21139) & ChrW$(-14924)
తెలుగు
Arial Unicode MS
ChrW$(3108) & ChrW$(3142) & ChrW$(3122) & ChrW$(3137) & ChrW$(3095) &
ChrW$(3137
Čeština
EASTEUROPE_CHARSET
ChrW$(268) & ChrW$(101) & ChrW$(353) & ChrW$(116) & ChrW$(105) & ChrW$(110)
& ChrW$(97)
ಕನ್ನಡ
Arial Unicode MS
ChrW$(3221) & ChrW$(3240) & ChrW$(3277) & ChrW$(3240) & ChrW$(3233)
中文(中国)
GB2312_CHARSET
ChrW$(20013) & ChrW$(25991) & &(& & ChrW$(20013) & ChrW$(22269) &
ગુજરાતી
Arial Unicode MS
ChrW$(2711) & ChrW$(2753) & ChrW$(2716) & ChrW$(2736) & ChrW$(2750) &
ChrW$(2724) & ChrW$(2752)
TURKISH_CHARSET
ChrW$(84) & ChrW$(252) & ChrW$(114) & ChrW$(107) & ChrW$(231) & ChrW$(101)
தமிழ்
Arial Unicode MS
ChrW$(2980) & ChrW$(2990) & ChrW$(3007) & ChrW$(2996) & ChrW$(3021)
Application
Additional Requirements
Yes. Uses Unicode to store and manipulate strings.
Instrinsic controls, Properties Window(IDE), Clipboard, and PropertyBag are
ANSI only.
&NT/2000/XP/Vista/Win7/Win8
Yes. Uses Unicode to store and manipulate strings.
Uses Unicode:
DrawTextW Lib &user32& - TextOutW Lib &gdi32&
Installed. You may need to enable Far East language support via Control
Panel, Regional Options, Languages if it was not done so at install time.
No. Uses ANSI or *
to store and manipulate strings.
Uses ANSI:
DrawTextA Lib &user32& - TextOutA Lib &gdi32&or DrawTextW Lib
&Unicows& TextOutW Lib &Unicows&
You need to install at least one Unicode font. Arial MS Unicode used to be a
free(23Mb) download from Microsoft. It is installed automatically with Office XP
Pro or Frontpage 2002.
Microsoft Layer for Unicode on Win9x Systems (MSLU).
(269.7kb download) available free from Microsoft.
The current FileVersion is &1.0.4018.0&
April 21, 2003.
Automation 95/98/ME & NT/2000/XP/Vista
Yes. Uses Unicode to pass the strings back and forth.
XP now supports a total of 136 locales, which includes the 126 locales
supported by Windows 2000 and adds the following:
&Divehi – Maldives
&Galician – Spain
&Gujarati – India
&Kannada – India
&Kyrgyz (Cyrillic) – Republic of Kyrgyzstan
&Mongolian (Cyrillic) – Mongolia
&Punjabi (Gurmukhi) – India
&Syriac – Syria
&Telugu – India
&Invariant locale
Other international features New to XP:
New Indic and Arabic scripts(Gujarati, Gurmukhi, Telugu, Kannada, Syriac, Divehi).
More robust font display for East Asian languages.
Improved Regional Settings support.
Largely improved MUI support.
New Location (GEO).
Support for GB18030.
New Locales in Windows XP Service Pack 2
Windows XP Service Pack 2 introduces 25 additional locales and another 11
with Service Pack 2 Update:
Bengali (India)
Quechua (Bolivia)
Sami, Northern (Sweden)
Bosnian (Latin, Bosnia and Herzegovina)
Quechua (Ecuador)
Sami, Skolt (Finland)
Croatian (Latin, Bosnia and Herzegovina)
Quechua (Peru)
Sami, Southern (Norway)
isiXhosa (South Africa) Sami
Sami, Inari (Finland)
Sami, Southern (Sweden)
isiZulu (South Africa)
Sami, Lule (Norway)
Serbian (Cyrillic, Bosnia and Herzegovina)
Malayalam (India)
Sami, Lule (Sweden)
Serbian (Latin, Bosnia and Herzegovina)
Maltese (Malta) Sami
Sami, Northern (Finland)
Sesotho sa Leboa (South Africa)
Maori (New Zealand)
Sami, Northern (Norway)
Setswana (South Africa)
Welsh (United Kingdom)
Windows XP Service Pack 2 Update Locales
Bosnian (Cyrillic, Bosnia and Herzegovina)
Irish (Ireland)
Nepali (Nepal)
Filipino (Philippines)
Luxembourgish (Luxembourg)
Pashto (Afghanistan)
Frisian (Netherlands)
Mapudungun (Chile)
Romansh (Switzerland)
Inuktitut (Latin, Canada)
Mohawk (Mohawk)
Windows Vista New locales
Alsatian (France)
Hausa (Latin, Nigeria)
Spanish (United
Amharic (Ethiopia)
Igbo (Nigeria)
Tajik (Cyrillic,
Tajikistan)
Assamese (India)
Inuktitut (Syllabics, Canada)
(Latin, Algeria)
Bashkir (Russia)
Khmer (Cambodia)
Tibetan (PRC)
Bengali (Bangladesh)
K'iche (Guatemala)
Turkmen (Turkmenistan)
Breton (France)
Kinyarwanda (Rwanda)
Uighur (PRC)
Corsican (France)
Lao (Lao P.D.R.)
Upper Sorbian (Germany)
Dari (Afghanistan)
Lower Sorbian (Germany)
Wolof (Senegal)
English (India)
Mongolian (Traditional Mongolian, PRC)
Yakut (Russia)
English (Malaysia)
Occitan (France)
English (Singapore)
Oriya (India)
Yoruba (Nigeria)
Greenlandic (Greenland)
Sinhala (Sri Lanka)
These locales are automatically installed when you update Windows XP to SP2.
You can select new locales in Regional and Language Options. They are not
supported in Windows Server 2003.
International Locale Codes
Click Icon to your
left to Load Table.
&Please Wait...
Unicode Only LCIDs
Identifier
Related resources
Table of Known Code Pages
WesternEuropean_Mac
UserDefined
Japanese_Mac
AutoSelect
Arabic_Mac
Japanese_JIS
CP_THREAD_ACP
Japanese_JIS_Allow1byteKana
Cyrillic_Mac
Japanese_JIS_Allow1byteKanaSOSI
OEM_UnitedStates
Latin2_Mac
Korean_ISO
Arabic_ASMO708
Turkish_Mac
Japanese_AutoSelect
Arabic_DOS
Chinese_Traditional_CNS
Chinese_Simplified_AutoSelect
Chinese_Traditional_Eten
Korean_AutoSelect
Baltic_DOS
WesternEuropean_IA5
Chinese_Traditional_Auto_Select
WesternEuropean_DOS
German_IA5
Cyrillic_Auto_Select
Central_European_DOS
Swedish_IA5
Greek_AutoSelect
Icelandic_DOS
Norwegian_IA5
Arabic_AutoSelect
Hebrew_DOS
Japanese_EUC
Cyrillic_DOS
Cyrillic_KOI8R
Chinese_Simplified_EUC
Greek_DOS_Modern
Cyrillic_KOI8U
Korean_EUC
WesternEuropean_ISO
Chinese_Simplified_HZ
IBM_EBCDIC_GreekModern
Central_European_ISO
Baltic_ISO
Cyrillic_ISO
Arabic_ISO
Latin3_ISO
Unicode_BigEndian
Hebrew_ISO_Visual
Turkish_ISO
Latin9_ISO
Hebrew_ISO_Logical
Korean_Johab
* DBCS - Double-Byte Character
* This is a pseudo codepage. There is no corresponding NLS file.
This code page ID can only be used with WideCharToMultiByte() and MultiByteToWideChar() API calls.
Fonts used on Windows XP-SP1:
GetStockFont
GetStockObject
SYSTEM_FONT
MS Sans Serif
GetTextFace
GetStockFont
GetStockObject
DEFAULT_GUI_FONT
MS Sans Serif
GetTextFace
MS Shell Dlg
GetSysFontA
SystemParametersInfo
cf_Caption
GetSysFontA
SystemParametersInfo
GetSysFontA
SystemParametersInfo
cf_Message
GetSysFontA
SystemParametersInfo
cf_SmallCaption
GetSysFontA
SystemParametersInfo
Win2000/XP/Office2000/Office2003 should already have
Arial Unicode MS installed.
Win98 users will need a Unicode font to render Unicode glyphs.
Not redistributable.
Arial Unicode MS
Installed with Win2000/Office2000 or later.
Lucida Sans Unicode
Bitstream Cyberbit
Complete - Download Font and DOC
Bitstream Cyberbase
No CJK - Download Font and DOC
Bitstream CyberCJK
CJK only - Download Font and DOC
Shareware. US$5.00. Download
TITUS Cyberbit Basic
Non-Commercial use only.
UNICODE 4.0 compliant.
Download .
Doulos SIL
4.010.2004
Non-Commercial use only.
Hebrew Unicode
Non-Commercial use only.
Also see .
Sample Font Support for several Languages
Test Platform WinXP-SP1
Unicode MS
* Microsoft
Tahoma or Arial
* Microsoft
Sans Serif
ARA: مـرحبــاً
CHS: 欢迎
CHT: 歡迎
GEO: სასურველი
GRK: Καλώς ήλθατε
HEB: בִּרוּבִים חַבָּאִים
HIN: रवागत
JPN: よろてそ
KOR: 여보세요
PAN: ਜੀ ਆਇਆਂ ਨੂੰ
RUS: Добро пожаловать
TAM: 쏅얧주&
THA: การต้อนรับ
URD: स्वागत
VIE: t&nh từ
*&Tahoma, Arial do not support
all these languages but works due to Font Substitution.
Microsoft Layer for Unicode
Technology(UNICOWS.DLL)
While you can make a separate programs for specific platforms it
is often desirable to make one program that will work on all platforms. By using
Microsoft Layer for Unicode Technology (Unicows.DLL, 240kb), a single
executable can run on both NT-based and Win9x Platforms. In this case you can
use DrawTextW or TextOutW Lib &Unicows& for all platforms.
forwards calls to the system API if you are running on NT, 2000, or
XP platforms.
MSLU does not support the display of
characters that the system cannot display.
Therefore do not expect to see Chinese under Win98
English even though you have installed a font that supports Chinese(Arial
Unicode MS for example). For more info see Newsgroup
microsoft.public.platformsdk.mslayerforunicode and
Use this conditional compilation directive to test your code
with and without Unicows:
#If UNICOWS Then
Public Declare Function DrawTextW Lib "UNICOWS" (ByVal hdc As Long, ByVal lpStr As Long, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
Public Declare Function MultiByteToWideChar Lib "UNICOWS" (ByVal CodePage As Long, ByVal dwFlags As Long, ByRef lpMultiByteStr As Any, ByVal cchMultiByte As Long, ByVal lpWideCharStr As Long, ByVal cchWideChar As Long) As Long
Public Declare Function TextOutW Lib "UNICOWS" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As Long, ByVal nCount As Long) As Long
Public Declare Function WideCharToMultiByte Lib "UNICOWS" (ByVal CodePage As Long, ByVal dwFlags As Long, ByVal lpWideCharStr As Long, ByVal cchWideChar As Long, ByRef lpMultiByteStr As Any, ByVal cchMultiByte As Long, ByVal lpDefaultChar As String, ByVal lpUsedDefaultChar As Long) As Long
Public Declare Function DrawTextW Lib "user32" (ByVal hdc As Long, ByVal lpStr As Long, ByVal nCount As Long, lpRect As RECT, ByVal wFormat As Long) As Long
Public Declare Function MultiByteToWideChar Lib "kernel32" (ByVal CodePage As Long, ByVal dwFlags As Long, ByRef lpMultiByteStr As Any, ByVal cchMultiByte As Long, ByVal lpWideCharStr As Long, ByVal cchWideChar As Long) As Long
Public Declare Function TextOutW Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As Long, ByVal nCount As Long) As Long
Public Declare Function WideCharToMultiByte Lib "kernel32" (ByVal CodePage As Long, ByVal dwFlags As Long, ByVal lpWideCharStr As Long, ByVal cchWideChar As Long, ByRef lpMultiByteStr As Any, ByVal cchMultiByte As Long, ByVal lpDefaultChar As String, ByVal lpUsedDefaultChar As Long) As Long
Under Project/Properties/Make set
conditional compilation arguments to UNICOWS = -1
or UNICOWS = 0.
You may not need MSLU at all if
your program uses only DrawText or TextOut. In this case you can simply wrap the
ANSI and Wide versions into a Sub. Do not expect to see Unicode on Win9x
platforms even if you are using a Unicode font such as Arial Unicode MS:
'Put this in your startup (Initialise,Sub
Main, etc.)
&& Dim m_bIsNt as
&& ' Are we running NT?
&& Dim lVer As Long
&& lVer = GetVersion()
&& m_bIsNt = ((lVer And &H) = 0)
Public Sub pDrawText(ByVal hdc
As Long, ByVal s As String, tR As RECT, ByVal lFlags As Long)
&& Dim lPtr As Long
&& If (m_bIsNt) Then
&&&&& lPtr = StrPtr(s)
&&&&& If Not (lPtr = 0) Then
&&&&&&&& DrawTextW hdc, lPtr, -1, tR,
&&&&& End If
&&&&& DrawTextA hdc, s, -1, tR, lFlags
Public Sub pTextOut(ByVal lhDC As
Long, ByVal x As Long, ByVal y As Long, ByVal sText As String)
&& Dim lPtr As Long
&& If (m_bIsNt) Then
&&&&& lPtr = StrPtr(sText)
&&&&& If Not (lPtr = 0) Then
&&&&&&&& TextOutW lhDC, x, y, lPtr,
Len(sText)
&&&&& End If
&&&&& TextOutA lhDC, x, y, sText, Len(sText)
Public Sub pGetTextExtentPoint32(ByVal
hdc As Long, ByVal s As String, lpSize As SIZEAPI)
&& Dim lPtr As Long
&& If (m_bIsNt) Then
&&&&& lPtr = StrPtr(s)
&&&&& If Not (lPtr = 0) Then
&&&&&&&& GetTextExtentPoint32W hdc,
lPtr, Len(s), lpSize
&&&&& End If
&&&&& GetTextExtentPoint32A hdc, s, Len(s), lpSize
Uniscribe Architecture
In 1999 Microsoft introduced Uniscribe, a Windows system-level
component that could take advantage of OpenType fonts. Microsoft Windows 2000
and applications Internet Explorer 5 and Office 2000 were released with support
for Uniscribe built in.
For Windows 2000 and later, supports the processing of complex scripts, that
is, those scripts that need special processing to properly render them. It
includes a subset of the features found in GDI+ in Windows 2000 and Windows XP.
The rules governing the shaping and positioning of glyphs are specified and
catalogued in
The Unicode Standard: Worldwide Character Encoding, Version 2.0,
Addison-Wesley Publishing Company.
A complex script has at least one of the following attributes:
Allows bidirectional rendering.
Has contextual shaping.
Has combining characters.
Has specialized word-breaking and justification rules.
Filters out illegal character combinations.
You may wonder how WinXP
displays Unicode correctly even when you haven't selected a Font which supports
all the required characters.
&Font fallback: this mechanism, made available through Uniscribe (see section on
Complex Scripts Support), provides a fallback font (or a default font) when
dealing with complex scripts. If the selected font face does not include any
glyphs for the complex script that is about to be displayed, Uniscribe selects a
default hardcoded font for the given script. For example, if you have Hindi text
and the font is Courier, then Uniscribe will use the Mangal font. This technique
is internal to Uniscribe and developers can not add additional fonts to the list
of fallback fonts.&
Note: Set flags to SSA_FALLBACK
Uniscribe is installed with Internet Explorer 5.0 or later, MS Office, Win2000, WinXP.
Here are some versions of Uniscribe I found (including one found on Win98SE):
usp10.dll FileVersion Note: Not redistributable.
TimeDateStamp
(Internal)
22-Sep-1998
Download code
30-Nov-1999
Found on Win98SE \Windows\System
Download from
Installed with Internet Explorer 6
(lab06_N.4)
06-Jan-2001
MS Office 10 common archives
09-Sep-2002
XP-SP1 \Windows\System32
(xpsp_sp2_rtm.8)
07-Dec-2005
XP-SP2 \Windows\System32
(private/Lab06_dev(paulnel).
06-Aug-2002
Microsoft VOLT users community
27-Jun-2003
Microsoft Office 2003
Best results in tests run on Win98SE has been with Uniscribe version
1.. Microsoft Office 2003 version has not been tested yet.
A Vb wrapper for this library can be found in Internationalization with Visual Basic by Michael S. Kaplan. It comes
with a CD containing sample sourcecode. The sample includes a Uniscribe-aware
version of ExtTextOutW.&More info
A more complex C++ example can be found at &Supporting Multilanguage Text Layout and Complex Scripts
with Windows NT 5.0&. Dont be mislead by 'Windows NT 5.0' in the title
because this demo also works on Win98. More info .
Logical characters:
Display Plain Text and handle caret
placement:
Display Formatted Text and handle caret placement:
ARA: العربية
&العربية :ARA
ScriptGetCmap
ExtTextOut(ETO_GLYPHINDEX)
ScriptStringAnalyse - Calls ScriptItemise, Shape, Place etc.
ScriptStringGetLogicalWidths - Returns logical widths for the entire line
ScriptStringXtoCP - Pixel position to character index
ScriptStringCPtoX - Character index to pixel position
ScriptString_pSize - Gets points to SIZE structure for the line
ScriptStringOut - Render line to device
ScriptStringFree - All analyses must be freed
ScriptItemize - Break string on script and direction boundaries
ScriptLayout - Bidi embedding level interpreter
ScriptShape - Unicode to glyph translation
ScriptPlace - Width and position generation
ScriptTextOut - Render to device
ScriptXtoCP - Pixel position to character index
ScriptCPtoX - Character index to pixel position
ScriptGetLogicalWidths - Generate widths in character order
ScriptBreak - Get line breaking flags
This sample has been update and can be found on the Microsoft& Platform
SDK(August 2002 Edition, Windows XP SP1) if you have it installed under
C:\Program Files\Microsoft SDK\Samples\winui\globaldev\CSSamp. You may encounter
problems compiling this due to missing or outdated files.
12-Jul-2002
60,270 bytes
Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include
Microsoft Visual Studio\VC98\Include
05-Aug-2002
6,622 bytes
Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include
Microsoft Visual Studio\VC98\Include
15-Aug-2002
81,839 bytes
Microsoft Visual Studio .NET 2003\Vc7\PlatformSDK\Include
Microsoft SDK\Samples\winui\globaldev\CSSamp
To build an application that supports Unicode on all Platforms AND uses
Uniscribe you could use something similar to this:
Public Sub pDrawText(ByVal hdc As
Long, ByVal s As String, tR As RECT, ByVal lFlags As Long)
&& Dim lPtr As Long
&& If (IsNt) Then
&&&&& lPtr = StrPtr(s)
&&&&& If Not (lPtr = 0) Then
&&&&&&&& DrawTextW hdc, lPtr, -1, tR,
&&&&& End If
&&&&& If (IsUnicode(s)) Then
&&&&&&&& If (HasUniscribe) Then
&&&&&&&&&&& DrawTextU
hdc, s, tR, lFlags 'Uniscribe Wrapper
&&&&&&&& Else
&&&&&&&&&&& DrawTextM
hdc, s, tR, lFlags 'MultiByte Wrapper
&&&&&&&& End If
&&&&& Else
&&&&&&&& DrawTextA hdc, s, -1, tR,
&&&&& End If
Provides services for applications on international issues, including
conversion between code pages, font linking, code page &guessing&, line
breaking, and more. Installed with Internet Explorer 5.5 or later.
The only Vb wrapper for this library I can find is .
Provides a programming interface(control) for formatting text. This can be
used in lieu of Fm20.Dll Unicode TextBox. No distribution issues and comes with
source code.
Riched32.dll
Supports Unicode
Riched20.dll
May be installed
Expanded support for complex scripts, partly due to Uniscribe.
Riched20.dll
Hyphenation, page rotation, and Text Services Framework (TSF)
Msftedit.dll
Msftedit.dll
Rich Edit Controls
Unicode Aware
NT/2000/XP
Source code included
Source code included
Screenshot
GDI+ ships with Windows XP and 2000(SP3). You can also install
it on other windows platforms(98 or later). It is a free download from Microsoft
at . It is Unicode aware on all platforms and allows you to
draw high quality Unicode antialiased text. There is also support for rotation,
skewing, and text outlining(Logo style).
To use Unicode in Win98 you must install a Unicode font such as
Arial Unicode MS.Complex glyphs such as Chinese will render in Win98SE
English version even though the operating system doesn't support this via
DrawTextW or TextOutW!&How does it do this? GDI+ uses Uniscribe under the hood to render Unicode.
You can find more information on using GDI+ in Visual Basic here
Sample Vb source code, declares, and class wrapper.
Enter GDI+ in the search window at top of page.
Sample Vb source code and class wrapper.
GDI+ Type Library (GDIPlus.TLB) version 1.30 Updated Thursday, 02 Aug :14
This Type Library provides everything you need to
start working with GDI+ in Visual Basic giving you direct access to the native
GDI+ functions. The TLB only exposes the Native(Flat) exports from the GDI+ DLL
and not the C++ class methods.
Note: Most examples you will find on the WEB use
class wrappers which are geared to C++/.Net users. The Vb equivalent wrappers on
PSC and VbAccelerator are not complete so you may want to stick with local
GDIplus Declares or use a Type Library.
See advantage of using the TLB .
Windows TextOut() APIs
From antiquity, the routines DrawText(), TextOut()
and (more recently) ExtTextOut() have been the
work-horse APIs used to draw text. Except on OS editions localized for regions
of the world where complex scripts were needed, these routines did not do any
complex script handling. And in fact they still do not, except
on Windows 2000 and XP or later. On those operating systems, which come with Uniscribe as
a standard system component, these standard APIs now do complex script shaping
even for programs that have not been designed for it or are not expecting it
If you are coding a User Control or subclassing a control to take advantage
of Owner Draw or Custom Draw features then use API DrawTextW or TextOutW as
'Sample Vb code
Public Sub pDrawText(ByVal lhDC As Long, _
ByVal sText As String, _
ByRef rct As RECT, _
ByVal lFlags As Long)
If LenB(sText) Then
DrawTextW lhDC, StrPtr(sText), -1, rct, lFlags
Public Function pTextOut(ByVal lhDC As Long, ByVal x As Long, ByVal y As Long, sText As String)
TextOutW lhDC, x, y, StrPtr(sText), Len(sText)
End Function
Note: lFlags values can be found here: .
20-October- -0300
Trademarks
Unicode is a trademark of Unicode, Inc.
Microsoft, Visual Basic, VB.NET, and C#.NET are trademarks of Microsoft
Corporation.
Download original sGrid with source code free from
New version sGrid2 is now available with source code at .
The intrinsic controls that ship with Vb6 are not Unicode aware so you have
several options.
Use Windowless controls. If they are not installed you can find them on
Visual Studio Disk#3 VbExtras at \COMMON\TOOLS\VB\WINLESS.
You may find references on the WEB including MSDN and ltwtct98.chm claiming that
these controls are Unicode-enabled. This is NOT true and you will
get the infamous &????& when you try to set Unicode text.
Coerce the Vb6 intrinsic controls to be Unicode aware.
(some source code
available)
The static controls(Frame, CheckBox, OptionButton, and CommandButton) work OK
under WinXP.
The Label and Edit controls works only if you have a single language and set the
correct codepage. Multilanguage captions will display as &????&.
for a free set of the UniButton, UniFrame, UniOption, UniCheck, UniTreeView,
UniCaption(Dialog captions) controls. You will need a Unicode aware TextBox for
the property page. Purchase theirs or substitute with Fm20.DLL TextBox. These
controls have been built using the techniques detailed in Michael S. Kaplan's
Note: Most of the above techniques will not work under Themed WinXP
under the following conditions:
You are using a Vb6 manifest file in the IDE(Vb6.Exe.Manifest).
You compile the application and include a Manifest file..
You embed a Manifest file as a resource.
Purchase 3rd party controls which support Unicode. A package(suite) to
replace Vb's instrinsic controls can run US$400 or more. Download demos of these
controls and verify that they work under Themed WinXP. Also check to see if they
work on Win98.
Write your own API OwnerDraw controls (a formidable task):
Use CreateWindowEx, adding properties and events via subclassing..
Add code to resolve Focus issues since Vb is not aware of controls created
using CreateWindowEx.
Create a custom property page for Unicode strings since Vb's IDE Property
Page does not support Unicode.
Resolve PropertyBag storage/retrieval issues so Unicode strings are not
mangled into ANSI.
Resolve XP Theme issue by applying theme internal to the control. Resort to
Normal or Flat control if there is no XP Theme available.
for samples of owner-draw control code and techniques for applying XP Theme
parts programtically.
for Unicode replacements for Vb ANSI controls..
By far the easiest method is to use the MS Office Unicode aware controls
embedded in FM20.DLL.
Forms 2.0 Object Library (Unicode)
Advantages
Disadvantages
Although Microsoft does not recommend or provide support for use of these
controls under Visual Basic they do appear to work well despite the disclaimer.
No Microsoft support.
Easy way to get
limited Unicode support in your projects.
No Uniscribe support (No
or Complex Scripts). Because of this the control Font must contain
ALL the characters you are trying to render.
redistributable however anyone can get it for free by downloading MS
No XP theme support.
FM20ENU.Dll (installed only with US
versions of Office).
Windowless controls thus no hWnd.
Requires at least VB6-SP4 to use IME(Input Method Editor).
As can be seen above it is
a easy way to get limited Unicode support in your projects but falls
way short of something you would want to use in a Commercially distributed
application.
FM20ENU.Dll - Automatically
installed with English versions of Office. Users who have installed Office with
another language should check Windows\System32 folder for presence of this file.
If it is not present you can download and install it free as part of
ActiveXControlPad. You must have FM20ENU.Dll present to make Forms 2.0 Object
Library controls available in Vb6. The symptoms are that the controls appear
in the Vb Toolbox panel but an error occurs when you try to place one onto a
Sample Vb code using the TextBox from FM20.DLL:
TextBox1.Text = &CHS: & & ChrW$(&H6B22) & ChrW$(&H8FCE)
UTF8 is a lossless method of encoding UTF16 Unicode in 1-3
Unicode Hex
Unicode Dec
According to HTML standard, HTML files should be transmitted in Big-Endian
format and using Byte-Order Mark (BOM) is recommended. Since Windows Native
format is Little-Endian, to avoid the Endian conversion problem, it is
recommended to use UTF-8 encoding in HTML files. In addition to converting your
strings to UTF-8 add the following MetaTag to indicate your content as being
&&HEAD&&meta http-equiv='Content-Type' content='text/
charset=utf-8'&&/HEAD&&
WideCharToMultiByte Lib &kernel32&
MultiByteToWideChar Lib &kernel32&
Codepage CP_UTF8 = 65001
This is a pseudo codepage. There is no corresponding NLS file. This code page
ID can only be used with
WideCharToMultiByte() and
MultiByteToWideChar() API calls.
ConvertINetMultiByteToUnicode Lib &mlang&
ConvertINetUnicodeToMultiByteLib &mlang&
Minimum availability
Internet Explorer 5.5
UTF8 Conversions
Const CP_UTF8
As Long = 65001
Private Declare Function MultiByteToWideChar Lib "kernel32" (ByVal CodePage As Long, ByVal dwFlags As Long, ByVal lpMultiByteStr As Long,
Private Declare Function WideCharToMultiByte Lib "kernel32" (ByVal CodePage As Long, ByVal dwFlags As Long, ByVal lpWideCharStr As Long,
ByVal cchWideChar As Long, ByVal lpMultiByteStr As Long, ByVal cchMultiByte As Long, ByVal lpDefaultChar As Long, ByVal lpUsedDefaultChar
As Long) As Long
Public Function FromUTF8(ByRef Utf8() As Byte) As String
Dim lngOutLen As Long
Dim strWide As String
lngOutLen = MultiByteToWideChar(CP_UTF8, _
VarPtr(Utf8(LBound(Utf8))), _
UBound(Utf8) - LBound(Utf8) + 1, _
If lngOutLen = 0 Then
Err.Raise vbObjectError Or &HC312&, _
"FromUTF8", _
"Failed to decode string, system error " _
& CStr(Err.LastDllError)
strWide = String$(lngOutLen, 0)
lngOutLen = MultiByteToWideChar(CP_UTF8, _
VarPtr(Utf8(LBound(Utf8))), _
UBound(Utf8) - LBound(Utf8) + 1, _
StrPtr(strWide), _
lngOutLen)
If lngOutLen = 0 Then
Err.Raise vbObjectError Or &HC312&, _
"FromUTF8", _
"Failed to decode string, system error " _
& CStr(Err.LastDllError)
FromUTF8 = strWide
End Function
Public Function ToUTF8(ByVal Text As String) As Byte()
Dim lngOutLen As Long
Dim Utf8() As Byte
lngOutLen = WideCharToMultiByte(CP_UTF8, 0, StrPtr(Text), Len(Text), _
0, 0, 0, 0)
ReDim Utf8(lngOutLen - 1)
WideCharToMultiByte CP_UTF8, 0, StrPtr(Text), Len(Text), _
VarPtr(Utf8(0)), lngOutLen, 0, 0
ToUTF8 = Utf8
End Function
Sample Grid saved as HTML(UTF-8 encoded). Supports Header,
Filter Bar, Icons, Pictures, Backgrounds, Alignment, Unicode text, Cell
ForeColor/BackColor, and Hyperlinks
DemoHeader - ExportHTML
Multiline Headers
CHS: 欢迎
JPN: よろてそ
GEO: სასურველი
Insira o texto aqui
Insira o texto aqui
Insira o texto aqui
Insira o texto aqui
Insira o texto aqui
Insira o texto aqui
Insira o texto aqui
Insira o texto aqui
Type 1,Col3
ARA: مـرحبــاً
United Arab Emirates
Row1,Col10
Type 2,Col3
CHS: 欢迎
Chinese Simplified
Row2,Col10
Type 3,Col3
CHT: 歡迎
Chinese Traditional
Row3,Col10
Type 4,Col3
ENG: Welcome
United States
Washington, DC
Row4,Col10
HTML Table
CHS: 欢迎
JPN: よろてそ
KOR: 여보세요
Portuguese
PTB: Bem-vindo
Type 5,Col3
Row5,Col10
HTML Markers
CHS: 欢迎
JPN: よろてそ
KOR: 여보세요
Arabic, Roman, Alpha, Circle, Disc, Square, Upper/Lower Case.
Type 6,Col3
Row6,Col10
Type 7,Col3
HEB: בִּרוּבִים חַבָּאִים
Row7,Col10
Type 8,Col3
HIN: रवागत
Row8,Col10
Type 9,Col3
JPN: よろてそ
Row9,Col10
<font color="#FF1
Type 10,Col3
<font color="#FF-076
KOR: &#50668;&#48372;&#49464;&#50836;
Row10,Col10
Type 11,Col3
PAN: &#2588;&#2624; &#2566;&#2567;&#2566;&#2562; &#2600;&#2626;&#2672;
Row11,Col10
Type 12,Col3
PTB: Bem-vindo
Portuguese(BR)
Row12,Col10
Type 13,Col3
RUS: &#1044;&#1086;&#1073;&#1088;&#1086; &#1087;&#1086;&#1078;&#1072;&#1083;&#1086;&#1074;&#1072;&#1090;&#1100;
Russian Federation
Row13,Col10
Type 14,Col3
TAM: &#50117;&#50599;&#51452;&
Row14,Col10
Type 15,Col3
THA: &#3585;&#3634;&#3619;&#3605;&#3657;&#3629;&#3609;&#3619;&#3633;&#3610;
Row15,Col10
Type 16,Col3
URD: &#2360;&#2381;&#2357;&#2366;&#2327;&#2340;
Row16,Col10
Type 17,Col3
VIE: t&nh t&#7915;
Vietnamese
Row17,Col10
Type 18,Col3
ARA: &#1605;&#1600;&#1585;&#1581;&#1576;&#1600;&#1600;&#1575;&#1611;
United Arab Emirates
Row18,Col10
Type 19,Col3
CHS: &#27426;&#36814;
Chinese Simplified
Row19,Col10
<font color="#FF9
Type 20,Col3
<font color="#FF-124
CHT: &#27489;&#36814;
Chinese Traditional
Row20,Col10
Type 21,Col3
ENG: Welcome
United States
Washington, DC
Row21,Col10
Type 22,Col3
GEO: &#4321;&#4304;&#4321;&#4323;&#4320;&#4309;&#4308;&#4314;&#4312;
Row22,Col10
Type 23,Col3
GRK: &#922;&#945;&#955;&#974;&#962; &#942;&#955;&#952;&#945;&#964;&#949;
Row23,Col10
Type 24,Col3
HEB: &#1489;&#1468;&#1460;&#1512;&#1493;&#1468;&#1489;&#1460;&#1497;&#1501; &#1495;&#1463;&#1489;&#1468;&#1464;&#1488;&#1460;&#1497;&#1501;
Row24,Col10
Type 25,Col3
HIN: &#2352;&#2357;&#2366;&#2327;&#2340;
Row25,Col10
DemoFooter - ExportHTML
Exporting Unicode to a file usually involves prefixing the text
with a BOM (Byte Order Mark). See the table above to see what prefix is required
depending on the Unicode format. Using UTF-8 although it takes more space than
UTF-16 is recommended since it is easier to transport to other platforms and
easier to use in HTML.
for methods on how to
Read/Write Unicode files.
The VB Clipboard functions are ANSI only. If you need to access
the Clipboard 'Unicode string' you must use format 'CF_UNICODETEXT = 13'. Code
to do this can be found at
Standard Clipboard Formats
CF_TEXT = 1
CF_PENDATA = 10
CF_OWNERDISPLAY = &H80
CF_BITMAP = 2
CF_RIFF = 11
CF_DSPTEXT = &H81
CF_METAFILEPICT = 3
CF_WAVE = 12
CF_DSPBITMAP = &H82
CF_SYLK = 4
CF_UNICODETEXT = 13
CF_DSPMETAFILEPICT = &H83
CF_DIF = 5
CF_ENHMETAFILE = 14
CF_DSPENHMETAFILE = &H8E
CF_TIFF = 6
CF_HDROP = 15
CF_PRIVATEFIRST = &H200
CF_OEMTEXT = 7
CF_LOCALE = 16
CF_PRIVATELAST = &H2FF
CF_DIB = 8
CF_DIBV5 = 17
CF_GDIOBJFIRST = &H300
CF_PALETTE = 9
CF_MAX = 18
CF_GDIOBJLAST = &H3FF
Windows Message Clipboard
WM_PASTE = &H302
WM_CLEAR = &H303
WM_COPY = &H301
WM_CUT = &H300
WM_UNDO = &H304
Windows Clipboard API's
Declare Function CloseClipboard Lib &user32& () As Long
Declare Function CloseClipboard Lib &user32& () As Long
Declare Function EmptyClipboard Lib &user32& () As Long
Declare Function GetClipboardData Lib &user32& (ByVal wFormat As Long) As
Declare Function IsClipboardFormatAvailable Lib &user32& (ByVal wFormat As
Long) As Long
Declare Function OpenClipboard Lib &user32& (ByVal hwnd As Long) As Long
Declare Function SetClipboardData Lib &user32& (ByVal wFormat As Long, ByVal
hMem As Long) As Long
Chart Updated 18-Jul-2007
Block Name
# Codepoints
(Babelmap)
Basic Latin
Latin-1 Supplement
Latin Extended-A
Latin Extended-B
IPA Extensions
Arial Unicode MS
Spacing Modifier Letters
Combining Diacritical Marks
Greek and Coptic
Cyrillic Supplement
Arial Unicode MS
Estrangelo Edessa
Arabic Supplement
Arial Unicode MS
Arial Unicode MS
Devanagari
Arial Unicode MS
Arial Unicode MS
Angsana New
Arial Unicode MS
Arial Unicode MS
Arial Unicode MS
Hangul Jamo
Arial Unicode MS
Ethiopic Supplement
Arial Unicode MS
Arial Unicode MS
Unified Canadian Aboriginal Syllabics
Arial Unicode MS
Arial Unicode MS
Arial Unicode MS
Arial Unicode MS
Arial Unicode MS
Arial Unicode MS
Arial Unicode MS
Arial Unicode MS
Arial Unicode MS
Arial Unicode MS
Arial Unicode MS
New Tai Lue
Arial Unicode MS
Khmer Symbols
Arial Unicode MS
Arial Unicode MS
Arial Unicode MS
Phonetic Extensions
Arial Unicode MS
Phonetic Extensions Supplement
Arial Unicode MS
Combining Diacritical Marks Supplement
Arial Unicode MS
Latin Extended Additional
Greek Extended
General Punctuation
Superscripts and Subscripts
Currency Symbols
Combining Diacritical Marks for Symbols
Letterlike Symbols
Number Forms
Arial Unicode MS
Mathematical Operators
Arial Unicode MS
Miscellaneous Technical
Control Pictures
Optical Character Recognition
Enclosed Alphanumerics
Box Drawing
Block Elements
Geometric Shapes
Miscellaneous Symbols
Miscellaneous Mathematical Symbols-A
Arial Unicode MS
Supplemental Arrows-A
Arial Unicode MS
Braille Patterns
Arial Unicode MS
Supplemental Arrows-B
Arial Unicode MS
Miscellaneous Mathematical Symbols-B
Arial Unicode MS
Supplemental Mathematical Operators
Arial Unicode MS
Miscellaneous Symbols and Arrows
Arial Unicode MS
Glagolitic
Arial Unicode MS
Latin Extended-C
Arial Unicode MS
Arial Unicode MS
Georgian Supplement
Arial Unicode MS
Ethiopic Extended
Arial Unicode MS
Supplemental Punctuation
CJK Radicals Supplement
Kangxi Radicals
Ideographic Description Characters
CJK Symbols and Punctuation
Hangul Compatibility Jamo
Bopomofo Extended
CJK Strokes
Katakana Phonetic Extensions
Enclosed CJK Letters and Months
CJK Compatibility
CJK Unified Ideographs Extension A
Yijing Hexagram Symbols
CJK Unified Ideographs
Yi Syllables
Arial Unicode MS
Yi Radicals
Arial Unicode MS
Modifier Tone Letters
Latin Extended-D
Arial Unicode MS
Syloti Nagri
Arial Unicode MS
Hangul Syllables
High Surrogates
Arial Unicode MS
High Private Use Surrogates
Low Surrogates
Arial Unicode MS
Private Use Area
Arial Unicode MS
CJK Compatibility Ideographs
Alphabetic Presentation Forms
Arabic Presentation Forms-A
Arial Unicode MS
Variation Selectors
Vertical Forms
Combining Half Marks
CJK Compatibility Forms
Small Form Variants
Arabic Presentation Forms-B
Arial Unicode MS
Halfwidth and Fullwidth Forms
Linear B Syllabary
Linear B Ideograms
Aegean Numbers
Ancient Greek Numbers
Old Italic
Old Persian
Cypriot Syllabary
Phoenician
Kharoshthi
Cuneiform Numbers and Punctuation
Byzantine Musical Symbols
Musical Symbols
Ancient Greek Musical Notation
Tai Xuan Jing Symbols
Counting Rod Numerals
Mathematical Alphanumeric Symbols
CJK Unified Ideographs Extension B
CJK Compatibility Ideographs Supplement
Variation Selectors Supplement
Supplementary Private Use Area-A
Arial Unicode MS
Supplementary Private Use Area-B
Arial Unicode MS
These are the flags you can set when using API DrawTextW.
Combine using the OR operator. Example: DT_CENTER OR DT_WORDBREAK
Description
Justifies the text to the top of the rectangle.
Aligns text to the left.
Centers text horizontally in the rectangle.
Aligns text to the right.
DT_VCENTER
Centers text vertically. This value is used only
with the DT_SINGLELINE value.
Justifies the text to the bottom of the rectangle.
This value is used only with the DT_SINGLELINE value.
DT_WORDBREAK
Breaks words. Lines are automatically broken
between words if a word would extend past the edge of the rectangle specified by
the lpRect parameter. A carriage return-line feed sequence also breaks
If this is not specified, output is on one line.
DT_SINGLELINE
Displays text on a single line only. Carriage
returns and line feeds do not break the line.
DT_EXPANDTABS
Expands tab characters. The default number of
characters per tab is eight. The DT_WORD_ELLIPSIS, DT_PATH_ELLIPSIS, and
DT_END_ELLIPSIS values cannot be used with the DT_EXPANDTABS value.
DT_TABSTOP
Sets tab stops. Bits 158 (high-order byte of the
low-order word) of the uFormat parameter specify the number of characters
for each tab. The default number of characters per tab is eight. The
DT_CALCRECT, DT_EXTERNALLEADING, DT_INTERNAL, DT_NOCLIP, and DT_NOPREFIX values
cannot be used with the DT_TABSTOP value.
Draws without clipping.
DrawText is somewhat faster when DT_NOCLIP is used.
DT_EXTERNALLEADING
Includes the font external leading in line height.
Normally, external leading is not included in the height of a line of text.
DT_CALCRECT
Determines the width and height of the rectangle.
If there are multiple lines of text, DrawText
uses the width of the rectangle pointed to by the lpRect
parameter and extends the base of the rectangle to bound the last line of text.
If the largest word is wider than the rectangle, the width is expanded. If the
text is less than the width of the rectangle, the width is reduced. If there is
only one line of text,
DrawText modifies the right side of the rectangle so that it bounds the
last character in the line. In either case,
DrawText returns the height of the formatted text but
does not draw the text. Thus it should never be used as a
CellTextFormat parameter.
DT_NOPREFIX
Turns off processing of prefix characters.
Normally, DrawText interprets the mnemonic-prefix character & as a
directive to underscore the character that follows, and the mnemonic-prefix
characters && as a directive to print a single &. By specifying DT_NOPREFIX,
this processing is turned off. For example,
input string:
DT_NOPREFIX:
Compare with DT_HIDEPREFIX and DT_PREFIXONLY.
DT_INTERNAL
Uses the system font to calculate text metrics.
DT_EDITCONTROL
Duplicates the text-displaying characteristics of a
multiline edit control. Specifically, the average character width is calculated
in the same manner as for an edit control, and the function does not display a
partially visible last line.
DT_PATH_ELLIPSIS
For displayed text, replaces characters in the
middle of the string with ellipses so that the result fits in the specified
rectangle. If the string contains backslash (\) characters, DT_PATH_ELLIPSIS
preserves as much as possible of the text after the last backslash.
The string is not modified unless the DT_MODIFYSTRING flag is specified.
Compare with DT_END_ELLIPSIS and DT_WORD_ELLIPSIS.
DT_END_ELLIPSIS
For displayed text, if the end of a string does not
fit in the rectangle, it is truncated and ellipses are added. If a word that is
not at the end of the string goes beyond the limits of the rectangle, it is
truncated without ellipses.
The string is not modified unless the DT_MODIFYSTRING flag is specified.
Compare with DT_PATH_ELLIPSIS and DT_WORD_ELLIPSIS.
DT_MODIFYSTRING
Modifies the specified string to match the
displayed text. This value has no effect unless DT_END_ELLIPSIS or
DT_PATH_ELLIPSIS is specified.
DT_RTLREADING
Layout in right-to-left reading order for
bi-directional text when the font selected into the hdc
is a Hebrew or Arabic font. The default reading order for all text is
left-to-right.
DT_WORD_ELLIPSIS
Truncates any word that does not fit in the
rectangle and adds ellipses.
Compare with DT_END_ELLIPSIS and DT_PATH_ELLIPSIS.
DT_NOFULLWIDTHCHARBREAK
Windows 98/Me, Windows 2000/XP:
Prevents a line break at a DBCS (double-wide character string), so that the line
breaking rule is equivalent to SBCS strings. For example, this can be used in
Korean windows, for more readability of icon labels. This value has no effect
unless DT_WORDBREAK is specified.
DT_HIDEPREFIX
&&H100000&
Windows 2000/XP: Ignores the ampersand (&)
prefix character in the text. The letter that follows will not be underlined,
but other mnemonic-prefix characters are still processed. For example:
input string:
DT_HIDEPREFIX:
Compare with DT_NOPREFIX and DT_PREFIXONLY.
DT_PREFIXONLY
Windows 2000/XP: Draws only an underline at
the position of the character following the ampersand (&) prefix character. Does
not draw any other characters in the string. For example,
input string:
DT_PREFIXONLY:
Compare with DT_HIDEPREFIX and DT_NOPREFIX.
RTL(RightToLeft) provides support for languages such as Arabic,
Hebrew, Urdu.
Activation Method
Deactivate
SetProcessDefaultLayout (LAYOUT_RTL)
SetProcessDefaultLayout (0)
lExStyles = lExStyles Or WS_EX_LAYOUTRTL
lExStyles = lExStyles And Not WS_EX_LAYOUTRTL
Device Context
SetLayout(hdc, LAYOUT_RTL)
SetLayout (hdc, 0)
There are several Extended Style Constants used to enable Window Activation:
LTR (Default)
[ ENG: Welcome ]
&&#1575;&#1604;&#1593;&#1585;&#1576;&#1610;&#1577; :ARA]
WS_EX_LEFT = &H0
WS_EX_RIGHT = &H1000
WS_EX_LTRREADING = &H0
WS_EX_RTLREADING = &H2000
Read Direction
WS_EX_RIGHTSCROLLBAR = &H0
WS_EX_LEFTSCROLLBAR = &H4000
Vertical Scrollbar Alignment
WS_EX_LAYOUTRTL = &H400000
Right to left mirroring
WS_EX_NOINHERITLAYOUT = &H100000
Disable inheritence of mirroring by children
To test various Styles or Extended Styles put this code in a
Private Declare Function SetWindowLongA Lib "user32" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function SetWindowLongW Lib "user32" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLongA Lib "user32" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function GetWindowLongW Lib "user32" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Const GWL_EXSTYLE = (-20)
Private Const GWL_STYLE = (-16)
Public Sub pSetStylePlus(ByVal lHWnd As Long, _
ByVal lStyleFlags As Long, _
ByVal bState As Boolean, _
Optional ByVal bExtended As Boolean = False)
Dim lStyle As Long
GWL = IIf(bExtended, GWL_EXSTYLE, GWL_STYLE)
If (IsNt) Then
lStyle = GetWindowLongW(lHWnd, GWL)
lStyle = GetWindowLongA(lHWnd, GWL)
If (bState) Then
lStyle = lStyle Or lStyleFlags
lStyle = lStyle And Not lStyleFlags
If (IsNt) Then
SetWindowLongW lHWnd, GWL, lStyle
SetWindowLongA lHWnd, GWL, lStyle
End IfEnd Sub
CreateWindowEx:
In most cases you should set the extended style when the control
is created with CreateWindowEx.
You can also set the style later by adding or removing a style
flag. Use the code above to do this.
In the case of ListView you must update both the main ListView
and the Header component styles.
There is no header component yet when the control is created with CreateWindowEx
so you must update this after you have created a header in code.
In the case of DTPicker you must also update the Calendar
component.
MonthView is only one component so it can be set when the
control is created with CreateWindowEx.
UserControl:
Setting RightToLeft on a UserControl does nothing on our two
Platforms: Win98SE(English), and WinXP-SP1(Brazilian Portuguese) . It may in
fact work if your OS is Hebrew or Arabic.
You can use pSetStylePlus in the module above and
UserControl.hWnd to enable various RTL styles.
In some cases the control is correctly mirrored, i.e. ScrollBar
is on the left, Icons are aligned right. However the text is mirrored
which is not correct. This was corrected with the following code.
SetLayout hdc, IIf(bRTL, LAYOUT_RTL, 0)
Suggested reading MSDN:
Should not allow layout inheritance
Tabcontrol
Activating Mirroring per Device Context
GetLayout(hdc) will return the current layout state.
SetLayout(hdc, 0)
If the device context is not mirrored
SetLayout(hdc, LAYOUT_RTL)
If the device context is mirrored
SetLayout(hdc, LAYOUT_RTL Or
LAYOUT_BITMAP)
If the device context is mirrored and if the programmer does not want the
device context to have mirrored bitmaps
SetLayout(hdc, LAYOUT_RTL Or &LAYOUT_BITMAPORIENTATIONPRESERVED)
If the device context is mirrored and if the programmer wants the device
context to have mirrored bitmaps
Description
LAYOUT_RTL
Right to left
LAYOUT_BTT
Bottom to top
LAYOUT_VBH
Vertical before horizontal
LAYOUT_ORIENTATIONMASK
RTL + BTT + VBH
LAYOUT_BITMAPORIENTATIONPRESERVED
Visual Basic Bi-directional Features:
Visual Basic is bi-directional
(also known as &BIDI&)-enabled. Bi-directional is a generic term used to
describe software products that support Arabic
and other languages, which are written right-to-left. More specifically,
bi-directional refers to the product ability to manipulate and display text for
both left-to-right and right-to-left languages. For example, displaying a
sentence containing words written in both English and
Arabic requires bi-directional capability.Microsoft Visual Basic includes standard features to create and
run Windows applications with full bi-directional language functionality.
However, these features are operational only when Microsoft Visual Basic is
installed in a bi-directional 32-bit Microsoft Windows environment, such as
Arabic Microsoft Windows 95. Other
bi-directional 32-bit Microsoft Windows environments are available as well.
The Right-To-Left property has been added to forms, controls, and
other Visual Basic objects to provide an easy mechanism for creating objects
with bi-directional characteristics.
Although Right-To-Left is a part of every Microsoft Visual Basic
installation, it is operational only when Microsoft Visual Basic is installed in
a bi-directional 32-bit Microsoft Windows environment.
This is frustrating since we may be
developing on a non-BIDI environment but yet want to support BIDI.
Using WS_EX_LAYOUTRTL would seem the logical answer here but when you try to
manipulate a UserControl using this Flag it does not work correctly on a
non-BIDI OS.
The trick is to not bind the RightToLeft Property to the UserControl and
owner-draw the control& to replicate both BIDI and normal modes.
Thus LTR would use something like &DT_LEFT& and RTL would use &DT_RIGHT Or
DT_RTLREADING&.
DT_SINGLELINE or DT_WORDBREAK and other options would be added to both
alignments.
Here is what Microsoft has to say about &MiddleEast
- Frequently Asked Questions&
The part about installing Arabic Support to Win2000/XP/Vista is
You can take with a grain of salt these statements:
CyberActiveX
While you can't set this Property in a
UserControl unless you are in a BIDI environment you can Owner-Draw to
emulate RTL or set style to include
WS_EX_LAYOUTRTL.
On Windows XP: &Regional and Language Options& go to the &Advanced&
tab and change the &Language for non Unicode programs& to an
Arabic language.
This is not always necessary and makes development a pain on U.S.
systems. This might be true for SBCS but not for Unicode or when you are
developing you own controls.
Just so you do not have to reinvent the wheel check out
these hints:
If you pass a string to an API as
'String', VB will convert the Unicode string to ANSI first. Always use a pointer
such as StrPtr(sText) to pass a Unicode string.
You usually need to change the API Declare to a Long for this to work. This is
not necessary if your Function is Declared in a TLB.
Advanced source code for OwnerDraw Controls can be found at . Highly
recommended. This is a gold mine.
Use COMMCTRL.Tlb from&. It has
95% of what you need to deal with owner draw and custom draw controls. It nicely
wraps the Comctl32.Dll.
Owner Draw requires you to create the entire control from
scratch in code including drawing and event handling.
Custom Draw allows you to override a specific portion of a
control drawing cycle to mod}

我要回帖

更多关于 吃鸡0x00007 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信