字体、语言相关的API函数原型:5 k* s7 H: R; ?$ l$ p- {
( x% A; {7 t! }. YcreateFont 用指定的属性创建一种逻辑字体
5 y0 j5 U4 G& W- J) ncreateFontIndirect 用指定的属性创建一种逻辑字体 ) T+ _# u2 d8 D8 Z) d) P
GetStockObject 取得一个固有对象(笔、刷子、字体等)- K+ W/ W0 w+ M
$ X, s% p }% s7 d$ M
GetACP 检取ANSI系统代码页的标识符) h7 E& I8 q) A2 P
GetOEMCP 检取系统的OEM代码页标识符( k! w6 |' e6 u3 k1 `5 C
GetTextExtentPoint 判断一个字串的大小(范围)(用于限制输入)
) h- I- k) m# ~" u$ dEnumFontFamilies 列举指定设备可用的字体9 I# ?$ m- X, F$ i1 g* G: X
EnumFontFamiliesEx 列举指定设备可用的字体 % w* C5 y2 d. J" w) I8 j9 G( r
EnumFonts 列举指定设备可用的字体
8 a; l7 ?" W9 V- j# LGetSystemDefaultLangID 取得系统的默认语言ID
' n+ H( I) c( f/ k, ^+ L6 VGetUserDefaultLangID 为当前用户取得默认语言ID& y3 L3 j' v; t. |4 ]5 U
GetStringTypeA 获取ANSI字符串类型 ,返回指定字符串的字符类型信息
0 ]; C d% r# n! g) b4 `6 F/ ZGetStringTypeW 返回一个Unicode串的字符类型信息
+ A* c B, M$ n+ L. d6 {GetSystemDefaultLangID 检取系统缺省语言标识符
G0 K1 _. h' D) R0 K, [) |% AWideCharToMultiByte 把一个宽字符串映射为一个新字符串; k; D% Q: T1 Y4 {
0 \. w) z/ S4 P=====================================================================
2 J+ x1 B4 X1 d3 v8 l" b( f2 U
4 k; o8 H( S" z/ F: T6 k; BHFONT CreateFont(( `' E) T7 ]* c' p' G! B7 k# ~& x
3 B% b2 F0 D/ Q0 h; Eint nHeight, // logical height of font
2 X k6 `0 q6 ^. E9 G. Tint nWidth, // logical average character width
v) y2 l: o9 zint nEscapement, // angle of escapement & B' s* h3 t. S$ N a
int nOrientation, // base-line orientation angle
1 {# { P( c' X% ~: i6 ^int fnWeight, // font weight
* |1 ?# N; R' H; FDWORD fdwItalic, // italic attribute flag $ X6 N. m8 e j8 O+ u/ ^9 w" n
DWORD fdwUnderline, // underline attribute flag
# M6 N# `/ @4 k3 {. JDWORD fdwStrikeOut, // strikeout attribute flag
# s* E6 Z( U5 W; p8 {0 P8 YDWORD fdwCharSet, // character set identifier 8 s3 Q. D! ~: P; r# G1 N8 q
DWORD fdwOutputPrecision, // output precision - L6 M: Y4 G3 K
DWORD fdwClipPrecision, // clipping precision # {/ @. h0 j1 g
DWORD fdwQuality, // output quality
5 d8 w- k8 @3 p8 IDWORD fdwPitchAndFamily, // pitch and family
6 M+ `& M2 `; @LPCTSTR lpszFace // pointer to typeface name string
4 ~0 F1 |% E5 n);2 c; H- Z2 z" G5 \* g) V
% M: b+ Z/ G8 ]3 q7 |+ D, K9 k" D
==========================================================================
9 I1 ?6 a! F+ ^3 ~% `HFONT CreateFontIndirect(
$ ?+ m/ [; Y+ ]: T4 l/ I* P! z6 e/ J/ l! w# o* |4 \: J7 ^
CONST LOGFONT *lplf // pointer to logical font structure
" A, I+ C, Z' B" w. B1 N' W);5 _0 \8 D; s9 a' l7 J% y6 p
$ |; @4 r8 L8 ` n' B
==========================================================================8 c) C8 {" O! @
HGDIOBJ GetStockObject(
( M0 m9 I, A" Q J
) y! c; m; h3 H0 j. l/ O5 Nint fnObject // type of stock object : T! f. F* c' s. r
);
' L6 x9 d. c+ P! ^ G% s; t i( i. e9 U" u
, y. {6 F0 U( U5 B
fnObject
& g5 N1 E6 W8 B% `7 \8 {7 zSpecifies the type of stock object. This parameter can be any one of the following values: 5 c! a( B+ u- N/ K
Value
3 r: ?, h) U% E( P- N3 N4.BLACK_BRUSH Black brush.! S, E; \# `1 O; L1 f
3.DKGRAY_BRUSH Dark gray brush.
/ ^5 t- E3 Z/ z; D0 @2.GRAY_BRUSH Gray brush.
# N% g2 n% y6 h3 q$ B4 ?5.HOLLOW_BRUSH Hollow brush (equivalent to NULL_BRUSH).
' f' I) J1 |. J. D3 [1.LTGRAY_BRUSH Light gray brush.5 d3 k* T% \" C* ]5 ]
5.NULL_BRUSH Null brush (equivalent to HOLLOW_BRUSH).5 Z! [8 z$ ?) c% D. x( L7 s
0.WHITE_BRUSH White brush.
1 T8 U. e3 d! e% u) \" M1 |" B7.BLACK_PEN Black pen.! i, H3 g1 ]1 z; o) a5 a
8.NULL_PEN Null pen.3 C- C& I. g% N7 H3 }
6.WHITE_PEN White pen.. w8 y- W# Y, I! ]% V- Q) f0 l
11.(0B)ANSI_FIXED_FONT Windows fixed-pitch (monospace) system font." H( { }6 s2 N+ f* v6 T3 I
12.(0C)ANSI_VAR_FONT Windows variable-pitch (proportional space) system font.9 F& x: `6 M( ~! r- n8 a' T1 w
14.(0E)DEVICE_DEFAULT_FONT Windows NT only: Device-dependent font.# v' w! s9 @7 U! ?) j
17.(11)DEFAULT_GUI_FONT Windows 95 only: Default font for user interface objects such as menus and dialog boxes.(一般选这种)( K$ P9 F8 y, L* \7 F! B
10.(0A)OEM_FIXED_FONT Original equipment manufacturer (OEM) dependent fixed-pitch (monospace) font.1 ~7 V, }2 o/ w( S
13.(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.: S3 G% Y/ P6 o& W! V
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." f: q; p# M/ A& e% k5 B
15.DEFAULT_PALETTE Default palette. This palette consists of the static colors in the system palette.
& K2 @0 `9 o" X& w$ [. {If the function succeeds, the return value identifies the logical object requested.5 J' t; N; H5 j
If the function fails, the return value is NULL. 7 c$ e$ F( E d- ?" n8 f
=================================================================================
* Q" n+ r. [" k* j2 r9 ~7 R. z: ]% uThe GetACP function retrieves the current ANSI code-page identifier for the system.
; J5 I) {- j% x3 n' ^* i; M" u2 dUINT GetACP(VOID)2 v1 {! ~6 R: s. {7 ?
& k8 J# N! I7 ~5 i+ U3 @
Parameters& J7 s; c7 m/ p0 j; b
This function has no parameters. - ~ l; \2 n& A: ~8 Q
Return Values
% x, S" I+ F" R$ i s5 eIf 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.
% Q' i/ v* ?9 r" x2 g( `Remarks- M; G' T( m% i' x D8 Y
Following are the ANSI code-page identifiers:
8 d$ l0 G) r& [3 H9 yIdentifier Meaning3 i7 a8 }" ], d3 e& v2 V |
874 Thai
6 H, j0 ? Q" X) c6 v1 f932 Japan l1 ?8 E8 N' W/ }5 L F
936 Chinese (PRC, Singapore)
9 |+ \& I0 j# N. j5 D9 L/ t949 Korean
* a% N$ W3 H. w950 Chinese (Taiwan, Hong Kong)
Z- g2 T' W+ |% S# ^8 H+ |# c; {1200 Unicode (BMP of ISO 10646)* u9 e0 r9 f% O# N% m
1250 Windows 3.1 Eastern European
6 T# O1 D9 y6 c! X. z: W7 f1251 Windows 3.1 Cyrillic
2 C4 B: x. F% B2 V1252 Windows 3.1 Latin 1 (US, Western Europe)
* `# r( L9 g1 C; A, T- c3 k3 s1253 Windows 3.1 Greek. T: ~4 t1 S( b0 c! a1 S& O
1254 Windows 3.1 Turkish
; Q; n9 _* g' W6 L. p, s1255 Hebrew( i9 j, |7 e- d4 c; R/ A
1256 Arabic
( j8 @; ]- U5 ^8 ^1257 Baltic# T; C. m9 y B( L n- q
=============================================================================4 V/ q7 F6 i: q9 R& s0 g' ]
The GetOEMCP function retrieves the current OEM code-page identifier for the system. (OEM stands for original equipment manufacturer.)
( |8 `. @8 b; `; d1 D7 d9 Q0 o3 s5 x% K# F% x5 B. b4 X. K6 L
UINT GetOEMCP(VOID)% p& a7 U. V- K+ n, R9 P! U
% `% h8 i2 ^; [ x7 ^* ?
; p. g, v! `3 _3 i- iParameters+ }# F$ Z- A: H
# `% Z5 U6 [& y% U0 j1 qThis function has no parameters. ! ~6 t0 W& j N8 h2 L2 h+ R% i
/ i- |: ?3 G. }) SReturn Values& ?; U9 H& O8 ~, W
/ @( T* Z* q2 R5 ?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.* K0 _9 ?" u1 p) I% y- `9 x; S
( f6 _4 C: R, r' v- R4 F: L* r* }Remarks
7 R, K7 j- e6 j, p+ t9 c8 q1 _! t; ]' S" c1 G$ X+ Z! x
Following are the OEM code-page identifiers: 2 ^* U5 K e# X" l4 @ c
8 h; F. w# |6 M0 ]/ PIdentifier Meaning; b1 t7 E8 _+ c6 s$ n$ r5 ^
437 MS-DOS United States
! V, j5 l9 ]/ z3 E, r% B708 Arabic (ASMO 708)
( |/ J; c2 }" v- _) M* l709 Arabic (ASMO 449+, BCON V4)
3 u2 C" z. O8 L4 B; j' D4 |* V# C7 J710 Arabic (Transparent Arabic)
7 C! O& [0 U; G720 Arabic (Transparent ASMO)
6 k5 l. J7 N1 a& q737 Greek (formerly 437G)
6 g: m) P, s% Q775 Baltic
5 Q# c v K" r' l2 b* k850 MS-DOS Multilingual (Latin I)
% J7 S& S7 w8 ]. v852 MS-DOS Slavic (Latin II)3 D& M/ F. M. E, u- ?, S
855 IBM Cyrillic (primarily Russian)
/ j* K1 j& |+ @0 o" g857 IBM Turkish2 ^( E# i: L1 ]8 \
860 MS-DOS Portuguese6 i' d, r U* _3 }( Q1 L# ]" i$ H4 S
861 MS-DOS Icelandic, F9 G+ T- u& F* y
862 Hebrew. K' t7 i6 E1 ~$ x$ Y
863 MS-DOS Canadian-French. `! |( ?0 ^! ]9 B0 b* i' l/ }
864 Arabic0 v; b0 }6 h( ^" T* B, Q
865 MS-DOS Nordic" M+ J* K6 Y# R W: ^6 s
866 MS-DOS Russian (former USSR)
# r! }' W+ W- h869 IBM Modern Greek$ d( O( ~- o: V6 R( s7 x
874 Thai, r, \/ U; A# i" Q, I( z; t6 N
932 Japan. d9 ?' B" g. w9 M' I; x
936 Chinese (PRC, Singapore)
8 m6 Q H) d* }) m0 |* H$ {5 ?949 Korean
$ a! f0 k- y! q/ ?950 Chinese (Taiwan, Hong Kong) + E) a- i% N. P, g @1 k
1361 Korean (Johab)5 w* x- u- k9 _7 K4 R+ I
===============================================================================% A3 }/ Y# ^* c h
BOOL GetTextExtentPoint(
5 x0 P0 G# r$ Y9 j8 N1 X f( w: _; P6 R
HDC hdc, // handle of device context
* J9 n$ a u8 ^6 Q$ w7 @LPCTSTR lpString, // address of text string ' p* x) s) t# H$ N
int cbString, // number of characters in string
. K5 B1 p+ }: G5 ~4 t- m; { sLPSIZE lpSize // address of structure for string size
& F. f% [+ O4 s- w3 W);
( c3 H/ e; _- I2 ~9 l& X, ^, {===============================================================================
( X: Y5 z& G3 ~) a2 LThe EnumFontFamilies function enumerates the fonts in a specified font family that are available on a specified device. This function supersedes the EnumFonts function. k$ A/ z' R3 s* h) t+ ?
int EnumFontFamilies(
# r# n% _, ]6 u& V+ B, r" WHDC hdc, // handle to device control : v5 k" d9 X. Q; U* G: E
LPCTSTR lpszFamily, // pointer to family-name string 5 g% p/ G( _/ k- t# ~
FONTENUMPROC lpEnumFontFamProc, // pointer to callback function
. M$ @! U& u$ { l: W4 MLPARAM lParam // address of application-supplied data
) V6 m- e3 B& y: N7 f; M);$ E3 \# \$ U% s) R: G g
1 a$ p2 N( a) r* A2 K" wParameters$ B* V1 j3 K. C0 J
hdc
- ?! r( e: L0 `& JIdentifies the device context. b, N, W9 b, B
lpszFamily @4 o0 X- _4 i: s+ G' L
Points 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.
, b+ \% {' `+ ^lpEnumFontFamProc
1 q! i8 V! i9 A" LSpecifies the procedure-instance address of the application-defined callback function. For information about the callback function, see the EnumFontFamProc function.
! n- `+ K) ?2 ^6 b. g; W7 c& `) VlParam) X) B) j, O8 Z0 E/ a& i: e# r/ `2 {
Points to application-supplied data. The data is passed to the callback function along with the font information. : V2 R; ]+ k5 v3 Z: R
G3 H# q9 C$ F0 P; \Return Values
1 U! d5 U+ |# [2 NIf the function succeeds, the return value is the last value returned by the callback function. Its meaning is implementation specific.
1 ?: y9 T. p* M5 i=============================================================================- @" E- s- f9 j6 h! t; J: B
The EnumFontFamiliesEx function enumerates all fonts in the system that match the font characteristics specified by the $ f; i4 W9 Q# \6 L9 B
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.# R& R4 A9 O& }, @1 J3 }
! ]. V" s3 [7 ?) z3 q; `8 d
int EnumFontFamiliesEx(
" d* i; b% b2 t/ f5 @/ oHDC hdc, // handle to device context
; S+ {) E6 v. z0 V' U, JLPLOGFONT lpLogfont, // pointer to logical font information* ~* U- i& O+ @& r. Z
FONTENUMPROC lpEnumFontFamExProc, // pointer to callback function
" _0 O% Q9 o9 M8 ]" SLPARAM lParam, // application-supplied data
% ^! L7 [, `2 y6 Y; rDWORD dwFlags // reserved; must be zero) u; V4 F1 |6 _0 X# b
);
' n! M7 V4 \# a) }# S s=================================================================================8 |3 T5 u0 U2 ?- c+ {( i
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. 6 r9 |% u" |- d- S' t8 y6 t9 t# U
This function is provided for compatibility with earlier versions of Microsoft Windows. Win32-based applications should use the EnumFontFamilies function.
" `' R3 h& f. \1 ]. h" U1 w. I* G
8 R- S& A4 n1 M, b- a% dint EnumFonts(4 p h9 D! N9 L' E$ G
HDC hdc, // handle to device context
! R' |2 B0 x0 \3 rLPCTSTR lpFaceName, // pointer to font typeface name string 7 p0 f0 I& b, ~# \1 Z& g1 u2 F
FONTENUMPROC lpFontFunc, // pointer to callback function 3 h, A$ x) I u
LPARAM lParam // address of application-supplied data
* Q: O4 r- \/ I# a6 S);
) u* O% @2 L2 ^* B# y2 \( o% o
- Q. y& i/ W+ E4 M- O1 {, fParameters) e' r7 G6 l4 i. h) I% s
hdc
4 K8 ?% M1 I8 u8 x8 JIdentifies the device context.
6 x5 x! Y( I4 A0 k0 V' n6 nlpFaceName
: ^% G; p6 A T* T4 OPoints 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. : \9 ^1 X" T7 k
lpFontFunc4 m3 J; {+ d0 g: }! W( }
Points to the application-defined callback function. For more information about the callback function, see the EnumFontsProc function.
! O4 X- q7 X( }lParam
) u; j+ B# k/ ?: B9 b* kPoints to any application-defined data. The data is passed to the callback function along with the font information. 7 Z- }; a. ]2 I& \! w8 M
+ E; l. U& u; a& d) e
7 ~0 e( i6 D7 K* [
Return Values
/ ~6 B5 w' `: ]( ?5 j7 ^) {1 BIf the function succeeds, the return value is the last value returned by the callback function. Its meaning is defined by the application. 9 Q6 O0 v( C' n8 S+ a# b, S
======================================================================4 E! a& p/ C- x. N
The GetSystemDefaultLangID function retrieves the system default language identifier. & R; o2 a4 b. s( G6 @6 v+ j
3 y: w, u, d' [- n: [& f3 F
LANGID GetSystemDefaultLangID(VOID); |& t5 @4 ]2 e1 O+ G2 ? j/ N
2 k R, {5 I% K) |5 D+ c4 l1 I9 y
Parameters. y! l1 N- g4 G0 R( q7 D7 }! `2 X, S
This function has no parameters. 3 i3 J H/ ]9 Q# Z% o, U
Return Values1 g6 D/ C3 W u6 b/ r A' F
If the function succeeds, the return value is the system default language identifier.
( g2 t/ ]* |% e9 h6 t================================================================================# h( u* {. T" q3 D' ~! J
The GetUserDefaultLangID function retrieves the user default language identifier.
`& u; B' S& Q6 h: z% q- S/ T: b6 R1 j
LANGID GetUserDefaultLangID(VOID). [* {& U1 V1 O
0 [; `% G& q( ]5 V" }0 S
Parameters2 S2 A$ @* o# k- ?
This function has no parameters.
% Y8 G% i* G& O2 a' bReturn Values& x! S: N) _' Y1 i" _! ]' y
If the function succeeds, the return value is the user default language identifier.% O) C! c* \$ E3 p# Z0 `: `
================================================================================
5 ?$ R2 \; r0 H8 ^: ~, M1 O& Z+ d4 C
BOOL GetStringTypeA(: v" C1 K6 V x9 E) q
4 F/ W3 T- k0 P" I' _ ?
LCID Locale, // locale identifer/ V! D3 q0 Z; c- C+ e x8 t
DWORD dwInfoType, // information-type options O. e0 j$ F7 l7 }. C4 X
LPCSTR lpSrcStr, // pointer to the source string
) [0 f& u, q9 ]/ c7 yint cchSrc, // size, in bytes, of the source string ( ^, P2 W# T2 A8 v
LPWORD lpCharType // pointer to the buffer for output , j& w" k) D( @# X" @) {. n5 N
);+ z5 F" R( A& S- @4 z) Q
Parameters* ~* ?% C, R! \" b
Locale' a3 y) _ _7 c% U+ M" z
LOCALE_SYSTEM_DEFAULT Default system locale
- l- N8 c& `. C) p, w. jLOCALE_USER_DEFAULT Default user locale
/ ]. V# b0 k' R) G- d8 XdwInfoType1 F) t' {3 y$ t
CT_CTYPE1 Retrieve character type information.' e- Z) N6 D6 b3 X( ]) T; Y
CT_CTYPE2 Retrieve bidirectional layout information., o4 R& M7 G- p5 L0 Q( T- J6 D8 T4 U
CT_CTYPE3 Retrieve text processing information.
& Q3 ?- E$ P6 {9 p7 slpSrcStr4 A- c& I' L, G5 I: f; h
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.
5 L; X. c6 X0 x% O: b7 w8 ]0 ?cchSrc
* P* h1 J/ T, |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. ( T( ~0 I5 I# e0 C$ \2 n
lpCharType% f2 ?+ ^7 L" ~: _, H$ [
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.
; _+ f# Q, E" v% G" j! G T3 |+ }
Return Values u {- O1 U8 U
If the function succeeds, the return value is nonzero.8 m- C$ j% V: S
=================================================================; h; K1 W) O) e, S
BOOL GetStringTypeW($ G/ a0 ~2 J( \6 h- \
$ @7 t* ?9 \$ i5 z; ]# s
DWORD dwInfoType, // information-type options
0 z R5 z& `( E- sLPCWSTR lpSrcStr, // address of source string
6 t& r5 ?1 A. b3 d5 P1 N( vint cchSrc, // number of characters in string * U, p, s& J1 |$ Q# }4 b
LPWORD lpCharType // address of buffer for output % a( G4 [/ E1 M; A
);' ` O$ c& v3 Q* M
==========================================================================3 i; B) s" G* S5 n
The GetSystemDefaultLangID function retrieves the system default language identifier. . @2 u7 X" |: T( j, S# J f7 @/ N1 F4 k' w
LANGID GetSystemDefaultLangID(VOID)/ Z4 {0 | B+ ` K5 g3 D# `7 h
, P6 S; n& R1 @8 N9 s/ C; U/ O7 U
! ~1 }2 |1 [1 x3 u" ?9 k/ Q
Parameters: Y/ C! l5 I# i7 Q% J2 ?- I
This function has no parameters.
: @3 S1 t G: z8 H9 Q, R) s- K- |+ |& {. P: g$ z3 i1 {; L0 }
Return Values/ I5 u* G9 S, L/ o! z; o
If the function succeeds, the return value is the system default language identifier.
5 U* Y) m1 X5 J: A: W& i! m; m% z1 k. u% \& [' y
Remarks
6 g" i6 N, m* r F. Q5 \( w& tFor more information about language identifiers, see Language Identifiers and Locales.
! r& _% c9 `8 W* u# X8 A- k; }===============================================================================; a* ~9 B5 [9 O8 V: g) M6 d9 x
int WideCharToMultiByte(
* f3 \; v6 y: W6 O$ l# @/ S, M8 p, m1 K# J
UINT CodePage, // code page
3 L8 k. o6 u* X: mDWORD dwFlags, // performance and mapping flags
5 v" i; I4 E" I- ?LPCWSTR lpWideCharStr, // address of wide-character string " \' l/ \8 ]* ^1 w7 a6 k" S$ q0 r
int cchWideChar, // number of characters in string
; \" c4 `4 z# F* m0 S8 kLPSTR lpMultiByteStr, // address of buffer for new string - v) @5 V7 V U) N/ Q
int cchMultiByte, // size of buffer 0 [, L/ G4 {0 s2 `$ M" ?% o1 C8 Y/ o
LPCSTR lpDefaultChar, // address of default for unmappable characters # {# ?# D, L, A& K
LPBOOL lpUsedDefaultChar // address of flag set when default char. used
- \' R+ ~& z2 j2 Y); + \% l! Q4 F7 y
L* j* r( O& E& U) ?1 `/ n
8 X+ c: ^% ]5 |2 [Parameters( m' }* {% v( ?5 R
0 x K8 s# w+ I6 O5 e$ c: ?- v% B
CodePage
8 ~; }# i9 e1 E1 [& mSpecifies 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: / S# M5 f) N. {/ g
) N6 j) G8 u4 ?1 e& d9 kValue Meaning5 v8 p, h* [0 U' c( F- C1 x
CP_ACP ANSI code page
, f* J, Y) H2 T$ h! ]/ m; R3 ACP_MACCP Macintosh code page
" D( x1 Z1 U; K& h# YCP_OEMCP OEM code page$ E2 h4 ~: K8 f2 ^$ h! X; z; L
: c9 N3 c8 H- h* t+ kdwFlags
& E& Q; \# r) x7 FA 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:
+ H. j& s* @" c& N9 v' R0 o: V$ I8 e8 K% w* q1 Z3 K2 C
Value Meaning9 N0 b# j4 \# i1 N. E
WC_COMPOSITECHECK Convert composite characters to precomposed characters.0 d" F6 c. Q& Y1 R+ Y, {. V
WC_DISCARDNS Discard nonspacing characters during conversion.
9 z9 q' p* @5 T z8 ]0 S+ Q" qWC_SEPCHARS Generate separate characters during conversion. This is the default conversion behavior.8 }* S" i. r) v# h# G
WC_DEFAULTCHAR Replace exceptions with the default character during conversion.8 ?" N/ D5 O+ B3 H; J: }7 n5 w3 g
( K% @& _. z$ f8 |4 CWhen 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 8 T1 Q* E0 }* p. Z& Y
e is the base character, and the accent grave mark is the nonspacing character.4 R: K, ~ F; s4 Z" o5 K' r
: ?, v- N' n" Y4 N; s5 z# AWhen 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.
6 O: ?$ M+ Q, N$ M# H4 EThe functions default behavior is to generate separate characters (WC_SEPCHARS) for unmapped composite characters.: R5 i" _1 y; }6 k; c; q. Y1 u
7 K; m6 t3 o8 l1 ?, B
lpWideCharStr
3 J3 u, a' [" @/ C2 E) qPoints to the wide-character string to be converted. 0 Z4 I# T3 O7 p5 D V* [1 G
' I6 `$ Y& O# q% ]; icchWideChar
T( x, ^0 h1 O0 dSpecifies 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.
3 a' Y+ A* T+ Z
( A4 b. a5 \( M5 |2 BlpMultiByteStr6 f% @5 W5 d/ m; ^/ _4 P+ z8 }' i
Points to the buffer to receive the translated string.
Y6 f4 I* w6 ~$ v* M5 q( V d% j# V( n+ |. C- F; d& C
cchMultiByte9 Y5 v3 k: z3 }4 {. w: \
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.) " L7 Y6 f l. d% `- y; t, X
& a) u5 t% _5 o2 r! J4 D8 WlpDefaultChar
, o% V9 N& U7 J9 U$ c" JPoints 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. 2 M# M( I5 _5 T) i2 c$ s9 c
' @# {. y& ^3 }4 a: f- |
lpUsedDefaultChar, x/ ^# p; z% A4 X3 v1 ?% G
Points 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.
. k5 E: }) Z9 Z. \7 y! V2 U8 Z+ u. v
7 h% F' |, }2 k) T5 \* |# q( c F2 L. u2 k. C4 W
+ X) s4 C: Q$ ^/ wReturn Values/ G" W. j% }( {- D5 J9 L
1 D8 _6 R O# V& ~4 @7 \2 o! v7 B8 fIf the function succeeds, and cchMultiByte is nonzero, the return value is the number of bytes written to the buffer pointed to by lpMultiByteStr. / r; u4 U: m' c4 l! e
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.
, f1 i" p" C' Q |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:
( x8 K8 D: c8 k. ? ]! }$ k, r$ W& g) m# a2 a8 e
ERROR_INSUFFICIENT_BUFFER5 T0 K* ?7 A% @6 @ e. \; U8 P
ERROR_INVALID_FLAGS
5 {( S' j0 }+ O+ I4 nERROR_INVALID_PARAMETER |