字体、语言相关的API函数原型:
! s5 s7 T7 Q" B- P# w9 b; }+ h6 W, `
9 \, Z* ]+ P0 Z5 n( w& ScreateFont 用指定的属性创建一种逻辑字体 ! \- l% W% h( N6 |4 [( e
createFontIndirect 用指定的属性创建一种逻辑字体 / q0 d: M* F' f: B* O* S
GetStockObject 取得一个固有对象(笔、刷子、字体等)9 t9 f6 L. S2 w$ e& E
6 [: d# L; @& i1 w$ w ?
GetACP 检取ANSI系统代码页的标识符
. f2 \9 a3 J& `7 n0 x# i7 X( XGetOEMCP 检取系统的OEM代码页标识符
& m: E" o; f* [9 L' H5 r% iGetTextExtentPoint 判断一个字串的大小(范围)(用于限制输入), u \& d2 B- r, S
EnumFontFamilies 列举指定设备可用的字体7 t4 o* E+ F2 ?+ f' X
EnumFontFamiliesEx 列举指定设备可用的字体
: d0 L) |% \; H8 C1 r: \EnumFonts 列举指定设备可用的字体
& C. t7 U8 D; j1 c1 Y% ?GetSystemDefaultLangID 取得系统的默认语言ID
+ y. `: ]) _; L! O# DGetUserDefaultLangID 为当前用户取得默认语言ID
/ ~, e$ x* w# E, T5 L* UGetStringTypeA 获取ANSI字符串类型 ,返回指定字符串的字符类型信息
) y3 ~4 P" C0 G3 C$ g) SGetStringTypeW 返回一个Unicode串的字符类型信息
+ w& G1 M" C5 l7 t; x: _1 RGetSystemDefaultLangID 检取系统缺省语言标识符2 U+ N. W) {9 d
WideCharToMultiByte 把一个宽字符串映射为一个新字符串2 z$ r7 g7 R6 G; b* ?
. |0 x! C+ v3 c$ T) d=====================================================================
. u$ U& k6 Z9 f- l3 V: h) F! p
% H; b: U% M% o9 G* Q/ V, _( gHFONT CreateFont(" h/ ]1 `3 B3 t9 ^* C$ K R1 \; K
8 f8 R N8 V2 X& D, X( ? v5 ^) y
int nHeight, // logical height of font ; Y* n' m+ I# g6 Y. _& D
int nWidth, // logical average character width
_" g2 [2 w- o Mint nEscapement, // angle of escapement ( P- ]9 j* b9 ^) S1 g3 Y
int nOrientation, // base-line orientation angle 2 }: l/ z( P3 B P) I1 ?4 A# K
int fnWeight, // font weight
[1 \5 l) x- p$ t( N+ V" tDWORD fdwItalic, // italic attribute flag
' Y1 E1 ?: w* S/ M$ T/ ?1 Z6 W5 NDWORD fdwUnderline, // underline attribute flag & D) U9 o: y% q0 J" z- i& a1 h
DWORD fdwStrikeOut, // strikeout attribute flag
( _! a- s6 i4 x [8 jDWORD fdwCharSet, // character set identifier
5 C6 v; h/ i' ?' F" A$ c' k) iDWORD fdwOutputPrecision, // output precision
9 R7 n; u; [$ LDWORD fdwClipPrecision, // clipping precision + V3 B' K) `! q8 X4 H/ f0 c' u* s
DWORD fdwQuality, // output quality
8 g5 i5 e$ K! {% |DWORD fdwPitchAndFamily, // pitch and family , O3 [5 a7 A, N/ m8 R8 d
LPCTSTR lpszFace // pointer to typeface name string
. ]" W# i" i7 t);. X0 c' P$ h1 R2 v* E7 G
( Z# x1 t1 ^% w+ v8 m==========================================================================
' d u! B+ [* l+ RHFONT CreateFontIndirect(
, v1 q- ~& F7 D) J' H; {: @6 {
) j4 Z, {, L+ C+ F& A4 UCONST LOGFONT *lplf // pointer to logical font structure
4 q5 o B7 M% \/ H+ d) C);: q7 d% i# C4 K
) ?3 s% u1 U8 M* {9 R- j% i% x0 ^
==========================================================================* Y; U8 t; l5 w+ ]- V! h
HGDIOBJ GetStockObject( i" u+ j5 `1 B. u/ Y7 E
/ Z; I" c. C: `5 cint fnObject // type of stock object
8 P0 p! G' T7 Z);; l6 t3 ?6 c6 }4 k `
: Q/ a2 Q" |3 |0 l; F+ F3 m) J. y; t
- m7 m) w. r- T& y/ m8 a1 v* R- A( dfnObject
* ^, U6 [; O0 }! e. HSpecifies the type of stock object. This parameter can be any one of the following values:
]4 V, I1 d9 L9 l: m! i3 y; _5 WValue # r0 U9 j( C0 ^+ x. B! y
4.BLACK_BRUSH Black brush.& K8 J- x( e' u4 f& O
3.DKGRAY_BRUSH Dark gray brush.
; K. R# E/ J6 o5 a2.GRAY_BRUSH Gray brush.. N4 r8 j9 w& O5 V: g
5.HOLLOW_BRUSH Hollow brush (equivalent to NULL_BRUSH).
- B# d, y# P: s2 M! w- I+ e1.LTGRAY_BRUSH Light gray brush.
. {, I; r5 ^2 E" o$ |6 ~5.NULL_BRUSH Null brush (equivalent to HOLLOW_BRUSH).
; P- |/ A, v5 V. u0.WHITE_BRUSH White brush.7 g: d! L0 C) Q. _
7.BLACK_PEN Black pen.' v/ f+ y# w' g& b- h
8.NULL_PEN Null pen.
: n3 N* U0 ^& X5 ~7 E6 d& b6.WHITE_PEN White pen.
/ [4 [% ?- _( E- a5 S$ @11.(0B)ANSI_FIXED_FONT Windows fixed-pitch (monospace) system font.6 m3 X& \0 |, [6 N# j0 g2 j
12.(0C)ANSI_VAR_FONT Windows variable-pitch (proportional space) system font.
( B& M& d' R( e3 F' u14.(0E)DEVICE_DEFAULT_FONT Windows NT only: Device-dependent font.
7 o) n2 m' w& Y% W" p17.(11)DEFAULT_GUI_FONT Windows 95 only: Default font for user interface objects such as menus and dialog boxes.(一般选这种)
8 ]1 ~: R: c2 N6 u$ w10.(0A)OEM_FIXED_FONT Original equipment manufacturer (OEM) dependent fixed-pitch (monospace) font.
; ^% p8 |0 C+ l" k13.(0D)SYSTEM_FONT System font. By default, Windows uses the system font to draw menus, dialog box controls, and text. In Windows versions 3.0 and later, the system font is a proportionally spaced font; earlier versions of Windows used a monospace system font.0 r' p% \# x/ a' K0 U
16.(10)SYSTEM_FIXED_FONT Fixed-pitch (monospace) system font used in Windows versions earlier than 3.0. This stock object is provided for compatibility with earlier versions of Windows.
/ Z7 D; o2 h6 n9 k7 f% B5 \15.DEFAULT_PALETTE Default palette. This palette consists of the static colors in the system palette.1 W% n% [- F4 Y
If the function succeeds, the return value identifies the logical object requested.
7 d6 q% ]" P* D/ R( h. i' X% OIf the function fails, the return value is NULL.
+ D# O. A5 ~8 b=================================================================================
7 y4 a- c# x0 aThe GetACP function retrieves the current ANSI code-page identifier for the system.: |* }) }" t, y
UINT GetACP(VOID)
2 q; ~. f6 V& A6 r
5 k" x( ^, i8 J; S! lParameters2 b1 Q! j3 `% ^0 I' z, [
This function has no parameters. @" c/ P% Q* Z% B- B! A
Return Values
( w6 B: n! p' |' w. y2 Q3 D8 ]: ]If the function succeeds, the return value is the current ANSI code-page identifier for the system, or a default identifier if no code page is current.
6 S* U+ { _# b* `Remarks& E6 |" |6 h* Y" b; h$ H
Following are the ANSI code-page identifiers:
# V! E2 P3 V' u: _Identifier Meaning
: F& l( {3 E# B- [ t4 `874 Thai1 w" V6 x; D& L) X! ~
932 Japan% w4 X9 J" s& ]! U/ r5 `* |( s6 e
936 Chinese (PRC, Singapore)+ v$ f! g6 Q: \8 l4 J7 k
949 Korean; r& m% }" I |, q( f/ F! [
950 Chinese (Taiwan, Hong Kong) % s; u/ T8 R8 j H! N4 r: Y- X7 M
1200 Unicode (BMP of ISO 10646)
% N- z4 n0 y7 L( O5 g Y1250 Windows 3.1 Eastern European * V0 u0 K, s8 h/ r
1251 Windows 3.1 Cyrillic
& n- B3 ~3 D) g1 }. V- e+ J1252 Windows 3.1 Latin 1 (US, Western Europe)
! n' q E ]( X2 t- N; X1253 Windows 3.1 Greek
, \, z# L; E1 h+ O1254 Windows 3.1 Turkish8 A5 g( t9 x) L: f) P, X8 Y/ x
1255 Hebrew- c, T7 n9 U4 K! S( {
1256 Arabic4 l/ T. [& d1 q' u- x: Z. R
1257 Baltic" v1 J; n' u1 T4 [" `
=============================================================================
! i3 f1 p9 ?1 Q4 QThe GetOEMCP function retrieves the current OEM code-page identifier for the system. (OEM stands for original equipment manufacturer.) 1 ~. u7 Z" T( S9 M- \& V3 F
- [1 }" Y/ a: C9 |; z% ^% ~
UINT GetOEMCP(VOID)8 x3 y8 f6 }0 s, B. E" \) {
& |1 L2 A8 N& w. Q9 `1 {. Y% O2 Y) m7 S4 F5 R, N$ K7 b
Parameters
# n8 Q" ~# t" E/ Y5 C% \$ f% x1 {, ^0 c7 K7 {1 q+ Z
This function has no parameters. 5 _9 ?8 O8 O* d D, H# R
; {! g/ h& J+ p( KReturn Values
* I% [8 {/ u' l: Z- s$ K
d+ N& b# \& H, \If the function succeeds, the return value is the current OEM code-page identifier for the system or a default identifier if no code page is current.
5 [1 C# x# O, x4 X
6 C5 m4 C8 _: h2 vRemarks
5 H3 \2 f# R4 M3 Z( d: ^9 J" i1 s" m8 M; L
Following are the OEM code-page identifiers: ; A1 M+ `% a3 [. \ x1 u+ @
- D. j2 W. c0 L) d2 R( ~) U: a* f: P
Identifier Meaning. s# v" R3 U: [5 [" i. {4 }
437 MS-DOS United States7 U0 B+ C2 e$ a! { e6 U4 @
708 Arabic (ASMO 708)
4 ]4 ], j5 c6 b' T# f C, `& w709 Arabic (ASMO 449+, BCON V4)+ t! z9 c) S4 }8 M; {& n# L% `7 s
710 Arabic (Transparent Arabic), ]& h9 l$ N5 X* T x" ^
720 Arabic (Transparent ASMO)
4 G- \1 H( _# j! K& W737 Greek (formerly 437G)
; X" l& o; m ?2 c775 Baltic
7 b' \+ T$ g2 Z8 ^& ?1 R850 MS-DOS Multilingual (Latin I)
/ W# h5 G# o" o: y852 MS-DOS Slavic (Latin II)
: N# H7 x& H/ U# g; b& y$ \5 y855 IBM Cyrillic (primarily Russian)
- [" W3 I1 v) U3 Q857 IBM Turkish
: A% {0 X) u: \' {3 A860 MS-DOS Portuguese
6 v0 k8 k ~6 c i# c: a' M861 MS-DOS Icelandic5 m: j3 w) {1 T, l% @
862 Hebrew
4 ?) }% S& ?7 p: S% ?- X$ }863 MS-DOS Canadian-French
6 B) ]- x6 y1 G0 ]# X0 U864 Arabic
' ~9 r+ K2 ], x* s865 MS-DOS Nordic! ^- \* T3 O/ [/ N$ P; I5 [( L$ d) \
866 MS-DOS Russian (former USSR); R7 I1 ?% ~' |! O3 X
869 IBM Modern Greek7 r: Y6 ^# N: k
874 Thai
- q& ]" M- ~, K+ d- |& u. {932 Japan9 I. J0 Z4 q; D1 J! b' a* E
936 Chinese (PRC, Singapore)
3 o5 T8 K1 \' O; c- D( T! ^" Z% k949 Korean+ A+ O8 F2 h$ O! r+ L+ b& V0 A
950 Chinese (Taiwan, Hong Kong)
A g$ F m1 ]1 ]+ k6 H1 j z! ^1361 Korean (Johab)
. q7 s/ m1 ?1 n' e" M/ ^===============================================================================
o- [6 Z0 l5 j" D/ m! ~BOOL GetTextExtentPoint(* h: B; _. S1 ~* ~+ |; m
! V" `( q, l# U
HDC hdc, // handle of device context : G2 B* z3 [9 {/ `" f T7 t
LPCTSTR lpString, // address of text string
' b6 k$ E8 y" K8 Y4 iint cbString, // number of characters in string
8 t( {- _6 w8 u7 SLPSIZE lpSize // address of structure for string size
( S( m) W% g7 D2 ? t+ R$ q* g);1 @+ P% R% i: y( d# _! o
=============================================================================== ~1 K8 M$ _7 e
The EnumFontFamilies function enumerates the fonts in a specified font family that are available on a specified device. This function supersedes the EnumFonts function.
1 J" _& [ J( \0 i2 }% C aint EnumFontFamilies(/ _* |3 i" S4 b( Y$ t
HDC hdc, // handle to device control & _# U3 s5 ^ W# m, \0 p3 T
LPCTSTR lpszFamily, // pointer to family-name string
- |) i1 h3 M F# M' r, gFONTENUMPROC lpEnumFontFamProc, // pointer to callback function
& i3 ]8 ?6 f& M" tLPARAM lParam // address of application-supplied data ; y, f+ J- a& G8 E
);+ _, j" K' C& p0 R' W; V* c7 P
5 `# k# `! t+ v" G4 @- K: ]
Parameters
p: ]) I' e; J; u; ehdc! E0 P/ }/ _% |( u& s- M. `
Identifies the device context. ( b7 Y, z( m% s' Y4 X1 r4 S
lpszFamily
3 E; }4 v! l4 {/ E0 U7 d; p0 kPoints to a null-terminated string that specifies the family name of the desired fonts. If lpszFamily is NULL, EnumFontFamilies randomly selects and enumerates one font of each available type family.
3 Z6 x) d: y% Z" p( d+ slpEnumFontFamProc% M) o- G6 X( e9 H" d* x: \
Specifies the procedure-instance address of the application-defined callback function. For information about the callback function, see the EnumFontFamProc function.
: t9 ~, J% ]0 KlParam7 j ^7 e5 J0 V
Points to application-supplied data. The data is passed to the callback function along with the font information. ! S5 W+ C" y$ D5 x9 `1 a n5 u3 h% s
% d5 o, F, {$ j4 I9 G% k1 i1 j7 n
Return Values% w$ {/ B7 `# h% c4 a
If the function succeeds, the return value is the last value returned by the callback function. Its meaning is implementation specific. " N- I# c p3 \ y& [0 q
=============================================================================
1 r7 ~/ L: g/ I' t) l& K4 |$ c. w8 uThe EnumFontFamiliesEx function enumerates all fonts in the system that match the font characteristics specified by the , I! N) c, J6 _( j* Y% U B: J
LOGFONT structure. EnumFontFamiliesEx enumerates fonts based on typeface name, character set, or both. It is recommended that Win32-based applications use this function rather than EnumFontFamilies to enumerate fonts.
3 L5 K& Y# P/ n8 e( k: Q. D
- _0 a4 K9 a3 V+ jint EnumFontFamiliesEx(2 B' u+ m! g$ ?6 r
HDC hdc, // handle to device context' ?6 _7 N* u/ U1 g
LPLOGFONT lpLogfont, // pointer to logical font information
4 L; U# l7 L9 _6 j' \; {FONTENUMPROC lpEnumFontFamExProc, // pointer to callback function
8 V3 `3 @3 ~8 q! ZLPARAM lParam, // application-supplied data
: \: f9 ?5 W$ l8 x, aDWORD dwFlags // reserved; must be zero& U! ^8 ^9 j+ q( n/ y: H( [
);
2 N+ w+ C" T, Q0 o' w9 r=================================================================================* ^# `3 E% y% R" f7 X9 Y- k
The EnumFonts function enumerates the fonts available on a specified device. For each font with the specified typeface name, the EnumFonts function retrieves information about that font and passes it to the application-defined callback function. This callback function can process the font information as desired. Enumeration continues until there are no more fonts or the callback function returns zero. ) f8 j3 E. {! W
This function is provided for compatibility with earlier versions of Microsoft Windows. Win32-based applications should use the EnumFontFamilies function.3 o( U! N- K. u$ | e
9 d* }! y6 I8 S; @int EnumFonts(' I9 }: V! p3 b6 Z
HDC hdc, // handle to device context . i6 q, T$ j& f- u, ^9 `* n9 ?! }; X
LPCTSTR lpFaceName, // pointer to font typeface name string # s# Z2 `) {0 n1 M& F
FONTENUMPROC lpFontFunc, // pointer to callback function
, _0 f& r* X! L; _LPARAM lParam // address of application-supplied data % I; c, l9 O/ ?
);
, q7 b- s+ x0 h1 h1 [1 Z4 K
2 R2 _0 _) [8 I, n" X+ JParameters
8 Q- p4 d M2 R: [* ohdc' Y$ j t4 \! q c; E
Identifies the device context.
4 d# x3 k% l# ^% e0 I5 }* W6 LlpFaceName3 T3 p3 T$ `! n! y0 C r- A e
Points to a null-terminated character string that specifies the typeface name of the desired fonts. If lpFaceName is NULL, EnumFonts randomly selects and enumerates one font of each available typeface.
8 |: N6 r/ ]$ h4 I3 J; ]( RlpFontFunc
/ E& `% o2 u8 M4 V. hPoints to the application-defined callback function. For more information about the callback function, see the EnumFontsProc function.
: A1 C x( @6 zlParam. S: ~4 J: ?+ Y' P! E
Points to any application-defined data. The data is passed to the callback function along with the font information.
; C0 ~5 F( W8 V6 V3 G4 W, O- E" J8 [7 k6 [
# H2 p3 R, Z# f3 g
Return Values( W3 O2 k8 U- R
If the function succeeds, the return value is the last value returned by the callback function. Its meaning is defined by the application. 9 D4 a# K4 R: v' W" n. X5 ~2 A- \% V
======================================================================7 _9 S0 x) D! F) K' _
The GetSystemDefaultLangID function retrieves the system default language identifier.
# n5 O' o0 q& ~# T. O; X8 J% v: t9 a6 v' [. J: q" _
LANGID GetSystemDefaultLangID(VOID): w" X d* o* ^0 q' K
$ Z# _ A% K) G A( B1 bParameters- [ Q3 Q& h" T/ T) v+ [- t
This function has no parameters. 8 C. w5 ?2 u- H1 k
Return Values+ A/ r& M" g1 q. a& @* ]
If the function succeeds, the return value is the system default language identifier.8 |5 V! k6 Q1 R4 H7 B* |
================================================================================
, V R$ y W& C: Y7 WThe GetUserDefaultLangID function retrieves the user default language identifier.
$ j$ Z2 t7 j" U, l
& L _" w! X! S* k0 _* Y. GLANGID GetUserDefaultLangID(VOID)
7 i. B0 @! D. L% \/ ]( E) i# F- k1 N2 ?* L" D: V
Parameters5 n/ u8 ~ b5 u
This function has no parameters.
: o8 G' k( O o2 \# vReturn Values e6 c9 b1 s; Q, n
If the function succeeds, the return value is the user default language identifier.
( e0 ^% g, q6 z' q, v0 g================================================================================2 |% V( Q1 i% m; Z+ k9 X
9 m* S7 r- f2 T" s2 z2 |9 o" BBOOL GetStringTypeA(. B# n; t* I) t2 M# [
G3 i) t/ R: A$ ]8 yLCID Locale, // locale identifer+ m; k( g) m# x
DWORD dwInfoType, // information-type options ; B2 c2 g6 f8 w2 O( \
LPCSTR lpSrcStr, // pointer to the source string
) p* S' u3 ^. D1 yint cchSrc, // size, in bytes, of the source string
( l! e' } l( A8 H) |3 h3 x7 |9 bLPWORD lpCharType // pointer to the buffer for output
7 W. F9 x: i; T, Z! d);* X) k- @+ `8 ^; o- W6 }
Parameters
. i2 E. }7 a8 o' ]( Z9 zLocale
5 s# s6 F! B- a z! A m1 sLOCALE_SYSTEM_DEFAULT Default system locale
S/ Z' `7 E& x; TLOCALE_USER_DEFAULT Default user locale$ x5 c+ `0 h: f- E, f4 M
dwInfoType
1 j: e7 U2 T2 v1 ~' E2 ]6 `8 MCT_CTYPE1 Retrieve character type information.
5 @) s9 g$ W4 e/ ]CT_CTYPE2 Retrieve bidirectional layout information.) U( \8 X0 H0 i' U
CT_CTYPE3 Retrieve text processing information.- o7 h( w( z7 {4 G
lpSrcStr/ J5 y5 G _. e- n C* ~( E
Points to the string for which character types are requested. If cchSrc is -1, the string is assumed to be null terminated. This must be an ANSI string. Note that this can be a double-byte character set (DBCS) string if the locale is appropriate for DBCS.* X2 g0 F# N4 C7 f c
cchSrc
' |5 G/ c8 n4 \1 |Specifies the size, in bytes, of the string pointed to by the lpSrcStr parameter. If this count includes a null terminator, the function returns character type information for the null terminator. If this value is -1, the string is assumed to be null terminated and the length is calculated automatically. / p6 u4 y* }- }- V X
lpCharType, E# i# G" ^% d) A
Points to an array of 16-bit values. The length of this array must be large enough to receive one 16-bit value for each character in the source string. When the function returns, this array contains one word corresponding to each character in the source string. 9 F5 [, g' }3 g/ Z
3 k3 ^% e5 W( ?4 hReturn Values
! H( a5 P6 p# B3 x8 MIf the function succeeds, the return value is nonzero.
c1 y3 C; K0 Q) {$ O7 S/ c=================================================================" t$ H+ u2 k: k# b! f5 N9 W
BOOL GetStringTypeW(: I, v8 H5 m0 e' w% h/ O7 `; ?
8 s: l1 d9 p6 Q! ]DWORD dwInfoType, // information-type options $ W* T* v& _4 R
LPCWSTR lpSrcStr, // address of source string 8 w9 M# H% |1 X' d
int cchSrc, // number of characters in string
/ @5 o: X7 M% U3 ]1 ?LPWORD lpCharType // address of buffer for output
, O1 c7 V3 r3 b. f);9 g T5 u. O$ o1 j4 Y0 `
==========================================================================3 G' [1 n9 E8 e- S3 J& }
The GetSystemDefaultLangID function retrieves the system default language identifier.
- h: k$ g2 |" L$ ?LANGID GetSystemDefaultLangID(VOID)5 C; I- u. X( j* p; k
/ a) k' l S' E5 q% z0 J/ H3 Y8 Y6 U; _
Parameters& y7 r, Z1 t8 [3 ^
This function has no parameters. / |5 K" t' a C5 ]- o3 X
6 u* v8 E' p! G% Q
Return Values" ~3 A6 d0 W2 N( L/ t
If the function succeeds, the return value is the system default language identifier.% O! \ y" J. q0 n+ b2 c1 V0 A
2 M+ S1 T, P2 a. o; j4 f4 N! Y
Remarks# `5 m T. e* z' R
For more information about language identifiers, see Language Identifiers and Locales.$ L% F$ g R9 y& F
===============================================================================
4 B* s9 D! [. p7 E' |, nint WideCharToMultiByte(0 j+ S1 Y. ?/ ~. c% R8 z
j7 T* l' a5 ^4 }UINT CodePage, // code page
9 i3 A; c) Z; ]DWORD dwFlags, // performance and mapping flags
& o9 n" C- n: Q6 v1 N8 a4 HLPCWSTR lpWideCharStr, // address of wide-character string 7 D0 f8 ]* U) V
int cchWideChar, // number of characters in string 1 j; S+ H3 M( N
LPSTR lpMultiByteStr, // address of buffer for new string : g. \2 y, N3 w% E
int cchMultiByte, // size of buffer
2 D7 [+ G. J/ a4 y1 h E" sLPCSTR lpDefaultChar, // address of default for unmappable characters
8 m% U$ W8 Y3 k* x1 ]LPBOOL lpUsedDefaultChar // address of flag set when default char. used
5 J" f' n" y+ o. [8 s8 m);
5 l2 e' L2 Q; t- R& g$ @9 |, ]- _8 i: [0 P1 R8 t- n& g& e7 o% B, {( @
2 f3 P7 w- |0 c# A: `. dParameters
s' i; w2 B# V0 ]5 I' s& l" Q
4 x$ V! f9 Z1 Z2 r3 J+ z/ X$ V1 NCodePage) K- F0 V! I& X7 j
Specifies the code page used to perform the conversion. This parameter can be given the value of any codepage that is installed or available in the system. The following values may be used to specify one of the system default code pages:
2 b+ F% O! F2 S& E: F
% Z4 k* v( T7 P0 w1 K0 o# k. NValue Meaning6 C( n3 Z: y7 S5 [' C" W0 z7 `3 G
CP_ACP ANSI code page
2 s5 J0 h" `2 b1 O; ]; Q u! u- r7 {CP_MACCP Macintosh code page
6 j2 C. [' _, A2 G) ~7 s. ^& wCP_OEMCP OEM code page# s$ W) C& N5 P2 L/ E
$ V; \5 c3 ]! m# p; @
dwFlags( G4 H" W. @: o
A set of bit flags that specify the handling of unmapped characters. The function performs more quickly when none of these flags is set. The following flag constants are defined:
( @, n. E% l" J, S* V; q( J0 h4 _+ F+ L0 F
Value Meaning( w' }# W0 Z7 y7 A+ V/ d9 H
WC_COMPOSITECHECK Convert composite characters to precomposed characters.
e% \9 ]0 I4 l9 p' x2 `WC_DISCARDNS Discard nonspacing characters during conversion., O( O1 N7 p/ x
WC_SEPCHARS Generate separate characters during conversion. This is the default conversion behavior.$ b% L+ e# b9 A! W+ t/ j* U& F
WC_DEFAULTCHAR Replace exceptions with the default character during conversion.
0 Z# A2 v5 C. e7 O6 D1 I4 Q% U; w0 v
0 g3 C" }5 {% LWhen WC_COMPOSITECHECK is specified, the function converts composite characters to precomposed characters. A composite character consists of a base character and a nonspacing character, each having different character values. A precomposed character has a single character value for a base/nonspacing character combination. In the character ? the
7 w/ p6 ~4 R% E- P+ W |% qe is the base character, and the accent grave mark is the nonspacing character.
6 Y3 c$ s1 L* I$ i6 j" O0 r! N2 t) \5 K0 Z
When an application specifies WC_COMPOSITECHECK, it can use the last 3 flags in this list (WC_DISCARDNS, WC_SEPCHARS, and WC_DEFAULTCHAR) to customize the conversion to precomposed characters. These flags determine the functions behavior when there is no precomposed mapping for a base/nonspace character combination in a wide-character string. These last 3 flags can only be used if the WC_COMPOSITECHECK flag is set.
& x- F% r' ^2 w( j% x+ PThe functions default behavior is to generate separate characters (WC_SEPCHARS) for unmapped composite characters.
/ }+ s: k. _; x/ C- U; C
$ H" d2 F; f5 E) IlpWideCharStr
8 H0 p3 |( z0 q" `Points to the wide-character string to be converted.
: e! G# j3 X% e1 e6 O0 B; r7 q( p9 V8 ?' k( o+ `. X3 p: U. m/ W
cchWideChar, p$ k9 ]0 M3 X0 u6 U9 Q
Specifies the number of characters in the string pointed to by the lpWideCharStr parameter. If this value is -1, the string is assumed to be null-terminated and the length is calculated automatically.
: B/ l* y# z6 e% T' ?" N. S. U5 E) A1 J2 y( b
lpMultiByteStr& w: M/ y S2 E% S# ?
Points to the buffer to receive the translated string.
* {/ S! W+ P; c' b+ j. T8 o
, ^6 c. Y0 S a( t8 X' X$ I+ f" RcchMultiByte+ A2 r4 P0 {$ ]. m
Specifies the size in characters of the buffer pointed to by the lpMultiByteStr parameter. If this value is zero, the function returns the number of bytes required for the buffer. (In this case, the lpMultiByteStr buffer is not used.)
# w& U3 l( n- L0 r+ t3 } N6 g$ N/ @8 ~# |0 S* H7 Y8 l
lpDefaultChar2 k$ t% P! U: b3 \2 H7 V. m
Points to the character used if a wide character cannot be represented in the specified code page. If this parameter is NULL, a system default value is used. The function is faster when both lpDefaultChar and lpUsedDefaultChar are NULL. " t& ^; _1 g' D8 p- G: \6 ?
) P4 `1 |- I1 F V% e, Y
lpUsedDefaultChar
, S( B ^4 y* kPoints to a flag that indicates whether a default character was used. The flag is set to TRUE if one or more wide characters in the source string cannot be represented in the specified code page. Otherwise, the flag is set to FALSE. This parameter may be NULL. The function is faster when both lpDefaultChar and lpUsedDefaultChar are NULL.
( ^% ]7 h6 M3 W9 {) b& f0 z8 m- B6 q( X6 C
$ R* E( w9 b3 \" T* d7 }0 e& C# n+ d' h/ ^+ W) ?
Return Values5 K4 K) D7 M. `: X
/ k. R/ ^7 Q- Z# [2 U+ u
If the function succeeds, and cchMultiByte is nonzero, the return value is the number of bytes written to the buffer pointed to by lpMultiByteStr. 7 B; S6 I2 w$ c/ T! b
If the function succeeds, and cchMultiByte is zero, the return value is the required size, in bytes, for a buffer that can receive the translated string. 8 n' c+ F1 \2 H
If the function fails, the return value is zero. To get extended error information, call GetLastError. GetLastError may return one of the following error codes:
& N0 v. c; u: I3 Y" u+ G
5 R; N7 ?, ~3 b2 n9 z) wERROR_INSUFFICIENT_BUFFER" V+ g0 |" E9 r3 u; X0 ]' P" o+ g3 f# k2 J
ERROR_INVALID_FLAGS% W* x; w8 [+ R7 l& ]
ERROR_INVALID_PARAMETER |