字体、语言相关的API函数原型:! W, Y$ t/ p/ t1 {
9 k9 {5 L' j8 l; ecreateFont 用指定的属性创建一种逻辑字体
8 p( n7 Z1 C, T2 ~/ e! QcreateFontIndirect 用指定的属性创建一种逻辑字体 4 X$ x8 s. @. n, k
GetStockObject 取得一个固有对象(笔、刷子、字体等)
% i* v6 \9 Z9 u6 k8 Q! g# k- k* B" [( L1 a
GetACP 检取ANSI系统代码页的标识符" M0 L8 e/ {7 @0 Y+ ~! f. N5 a
GetOEMCP 检取系统的OEM代码页标识符
4 _6 l; R) y6 O' ]6 p: ]GetTextExtentPoint 判断一个字串的大小(范围)(用于限制输入)
' O1 u! N) r+ }3 O2 zEnumFontFamilies 列举指定设备可用的字体; P- J+ _1 r H$ y. U
EnumFontFamiliesEx 列举指定设备可用的字体 / ?" x8 Q( Y# D
EnumFonts 列举指定设备可用的字体
9 r$ e' w; s; L* V- r U' F% iGetSystemDefaultLangID 取得系统的默认语言ID / V' q4 f/ [9 T# u
GetUserDefaultLangID 为当前用户取得默认语言ID
( m8 \; e9 z) \+ x+ XGetStringTypeA 获取ANSI字符串类型 ,返回指定字符串的字符类型信息
( Z* L/ _ j# eGetStringTypeW 返回一个Unicode串的字符类型信息+ o. ~6 W3 n: Y& n: g- D
GetSystemDefaultLangID 检取系统缺省语言标识符
: N; f8 ?7 s% l4 AWideCharToMultiByte 把一个宽字符串映射为一个新字符串
; \1 t, T3 V- }3 ^$ R5 K! n4 Y
, e( w. i: l2 N1 j2 w=====================================================================
. O# d$ ]3 U. i! o! c& g
8 l1 ?+ a9 B8 A) _" s" ~, Q9 w# nHFONT CreateFont(, x* _- K. Q* r' p- |& p3 q. |
2 Q; K3 J( ]* d2 I+ i B) c9 g* a9 }
int nHeight, // logical height of font $ D! n6 [+ g2 b0 i) j5 }, W+ U
int nWidth, // logical average character width
( n4 T* w# ` r- Y3 E; r/ bint nEscapement, // angle of escapement . C* r1 r( ~) c; a' i
int nOrientation, // base-line orientation angle $ G2 J3 Y" } @& \5 U; h
int fnWeight, // font weight
, e" L" G( w o: @7 }DWORD fdwItalic, // italic attribute flag & s/ E$ f5 v: S, l" D
DWORD fdwUnderline, // underline attribute flag
: V; q" V/ ?# e* `$ H1 _ fDWORD fdwStrikeOut, // strikeout attribute flag
' g7 t- b. a h! B7 q6 C1 HDWORD fdwCharSet, // character set identifier
e9 O8 X! ~) y0 k( Z5 rDWORD fdwOutputPrecision, // output precision
: v8 @- W+ E+ ]5 Y- D$ z; e" DDWORD fdwClipPrecision, // clipping precision 8 I9 R: H, |3 U+ y$ {; d3 K. Q/ _- h* ?- M
DWORD fdwQuality, // output quality . A9 K( L8 L/ z" d: L- Y; c7 P
DWORD fdwPitchAndFamily, // pitch and family ( L4 C% `/ ?2 O- {% l
LPCTSTR lpszFace // pointer to typeface name string 9 B! b& l6 z1 A2 [ R% p8 @
);
. C" M! }! _ H1 }, S8 M
0 O7 v( ?0 ]3 z c==========================================================================
4 z8 n3 N A3 g6 R# Q, _/ m! g8 g- bHFONT CreateFontIndirect(2 ?: G2 ^4 l0 q' h0 z, a! S
3 b) F5 L9 C. r' o6 @( j
CONST LOGFONT *lplf // pointer to logical font structure ; K1 V z+ f g9 p9 ^, o8 d
);' q: l/ P/ d5 b {
0 b7 e2 q$ ^$ n/ o- r0 l2 D2 ]
==========================================================================
; M' o' D5 I2 ]$ q! \9 dHGDIOBJ GetStockObject(. v5 k3 Z1 Q9 M; A& e6 g3 I
" ?2 L- I. i( E3 ^
int fnObject // type of stock object ! z% q Z' I( P6 o) v7 g
);
/ Z# Z+ l8 e. ~ c6 b0 _; C; Y1 Z8 A% f/ u* ~7 V
. E3 p( Y. x3 U* DfnObject6 y/ q# W4 S' b2 D) b0 M! A1 t
Specifies the type of stock object. This parameter can be any one of the following values: + w7 G# |+ z4 ^
Value ) s: U: W* o* b: J1 @3 b
4.BLACK_BRUSH Black brush.
. {0 ?- n8 D# ^/ L3.DKGRAY_BRUSH Dark gray brush.2 s- E+ b6 b- h" Q3 g
2.GRAY_BRUSH Gray brush." P) j2 V# v( K% Z
5.HOLLOW_BRUSH Hollow brush (equivalent to NULL_BRUSH).
2 d. i0 s) ]; Q# ]" e1.LTGRAY_BRUSH Light gray brush.: V& |# r3 S/ {# s, z. k1 V
5.NULL_BRUSH Null brush (equivalent to HOLLOW_BRUSH).6 s+ g# r m" s% W+ t
0.WHITE_BRUSH White brush.
2 d% K1 H' C% T, C; N% {7.BLACK_PEN Black pen.
- b6 Y4 A, u3 r8 W! ]$ F" D/ W, ^8.NULL_PEN Null pen.) a. x: n! ]+ V9 r W6 ?0 `
6.WHITE_PEN White pen.
0 |6 Y8 f/ }2 k; y. G _- M, N11.(0B)ANSI_FIXED_FONT Windows fixed-pitch (monospace) system font.
7 J+ m& _$ f2 Y% b6 d12.(0C)ANSI_VAR_FONT Windows variable-pitch (proportional space) system font.
( g$ m: y `8 @" G% [+ i14.(0E)DEVICE_DEFAULT_FONT Windows NT only: Device-dependent font.
5 s8 ^/ K+ O0 n17.(11)DEFAULT_GUI_FONT Windows 95 only: Default font for user interface objects such as menus and dialog boxes.(一般选这种)) X5 c7 ^3 }9 y2 Z# ^7 ]
10.(0A)OEM_FIXED_FONT Original equipment manufacturer (OEM) dependent fixed-pitch (monospace) font.
A7 z1 R: R0 n( _) n13.(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.
& E% w" D$ A$ [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.
$ i; w- F4 v& B$ F5 c# y& B15.DEFAULT_PALETTE Default palette. This palette consists of the static colors in the system palette./ C; X `( ?# S$ a0 o# |1 c
If the function succeeds, the return value identifies the logical object requested.
$ b) A3 z" T2 RIf the function fails, the return value is NULL. ; T. b: v3 C4 V% a6 P
=================================================================================/ e9 E3 ~' t( P5 M7 x
The GetACP function retrieves the current ANSI code-page identifier for the system.3 V* z- R- N! {; o! M2 e. R
UINT GetACP(VOID)
8 S' j% [* x' j# H4 l8 u1 H% z' V* K7 r
Parameters4 e$ H. W) z* g @0 C
This function has no parameters.
; G! o6 j5 P/ }) F+ iReturn Values
- |# a$ L. h; K3 }' xIf 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.# a" y* p6 z( g" T8 p3 N' o
Remarks: I7 L* p' N9 h+ }5 H# G7 y
Following are the ANSI code-page identifiers: - a( v J5 o0 ~( t" T# ]
Identifier Meaning, W/ q% J) K, X+ @$ k
874 Thai- c- V3 e4 |, d. x/ P
932 Japan- v1 T! u! f( n$ _
936 Chinese (PRC, Singapore)
% C f9 `6 u% _ A. v949 Korean( T) X0 c: ^* x- p
950 Chinese (Taiwan, Hong Kong)
5 d0 D: q3 k1 U# Z2 y1200 Unicode (BMP of ISO 10646). K2 E. _4 s0 `8 H' K8 h
1250 Windows 3.1 Eastern European / n3 Y5 |( s5 v
1251 Windows 3.1 Cyrillic
+ ] J+ c4 e% j( B7 D; [1252 Windows 3.1 Latin 1 (US, Western Europe)
4 W% ^ c9 W! @' `1253 Windows 3.1 Greek1 H( p& U/ D" w2 C: B
1254 Windows 3.1 Turkish; e/ t |8 X+ G# ?6 V* |
1255 Hebrew$ u+ }/ T$ z/ j9 a# p6 N f
1256 Arabic6 _5 t0 ?* ?5 m- @) | C
1257 Baltic/ r* u6 U1 Y( e4 q- M) q/ e
=============================================================================
, p) p6 q6 g; O1 V/ g) }1 F( o- pThe GetOEMCP function retrieves the current OEM code-page identifier for the system. (OEM stands for original equipment manufacturer.) / s+ Y! d8 U* j5 A# g
2 `8 L1 a3 o: j% Q4 S& z
UINT GetOEMCP(VOID)
6 S# B: C- I" N1 l; H! i( s
3 l# O1 {# a" m2 P
0 t3 E* \9 V- G2 SParameters
& g" w- _ D' l, x" c& ?( c5 m* f2 h1 j* k* {
This function has no parameters. / v: B8 S3 { K, n; G4 E
& E2 C& Y0 V" B+ P! w {5 l" aReturn Values& E; X- \6 G- J8 D
! h& q& j! F4 w) T4 H) I
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., G9 M1 X/ U0 z# V
1 D$ a/ m* Q( N8 [
Remarks
% u4 K0 s o% C- W. Z. W& s5 [! F$ H' _( R! `8 g2 V1 ~4 e* I
Following are the OEM code-page identifiers: , K5 C$ U) |0 X( \
& x T7 q. ~; Y% a+ Y5 q$ MIdentifier Meaning
5 N7 I0 R6 a: U" [- h1 i. I3 k8 d437 MS-DOS United States4 m$ W% E( ?2 F0 W0 k- C% R
708 Arabic (ASMO 708)+ p @1 M% z9 ~6 d9 [
709 Arabic (ASMO 449+, BCON V4)
! |. V0 {* @4 _8 o$ ~710 Arabic (Transparent Arabic)
$ }3 i1 n% m+ S3 c6 O# q/ r# F( r720 Arabic (Transparent ASMO)
$ c T/ p2 H2 r8 M$ f% V3 e* v' W! |737 Greek (formerly 437G)
. S8 s- t- f% X# I+ _" [, h3 p775 Baltic1 _1 R$ J- o/ ^4 S# D
850 MS-DOS Multilingual (Latin I)
& i. X, D( b; l/ C/ z: {852 MS-DOS Slavic (Latin II)2 |( z: y1 q: _# C' D
855 IBM Cyrillic (primarily Russian) h8 g3 b, f/ w4 B4 ?. x
857 IBM Turkish
6 g" m2 O0 h( H1 o( t" }860 MS-DOS Portuguese
+ d, S3 u8 J. u5 X( q( O/ m861 MS-DOS Icelandic1 f& O+ T1 e( j }' M0 b# W9 e
862 Hebrew
, Y7 Y. ^0 I$ D1 v K863 MS-DOS Canadian-French
7 I4 ]2 J" v/ D! g$ h; h+ k& M3 O1 l2 z864 Arabic
: M2 L. f$ [5 U# W4 c5 l1 C865 MS-DOS Nordic, j; V1 {1 P' y. y$ K U/ L
866 MS-DOS Russian (former USSR)
$ E) u# v1 Y) a' A869 IBM Modern Greek, h3 H" o$ ~; k4 @0 q
874 Thai8 J( i% Y( U' o# w! y) b: z; \' M
932 Japan
$ ~; _1 M% O X936 Chinese (PRC, Singapore)
+ j' S1 c# J5 b949 Korean
1 D3 l1 N; F, k8 E7 V950 Chinese (Taiwan, Hong Kong)
_/ F, w4 V1 l% d l1361 Korean (Johab)
9 D( H6 {) ^7 M) E/ h% S: ~===============================================================================% o4 A) u* n) I9 f
BOOL GetTextExtentPoint(% U N+ m! Y9 _; Z, F* e
5 @% ~/ S9 i$ Q% F# U& y* M
HDC hdc, // handle of device context
( |$ T0 y( m- O0 R; H% P( o5 vLPCTSTR lpString, // address of text string ' Z0 o% Z& _( Y O. \/ }
int cbString, // number of characters in string
8 t5 F! c4 V' K; ]: TLPSIZE lpSize // address of structure for string size
' U( b# k7 a. o9 y% u);
. h0 l, d9 n0 e: j0 v4 V4 S===============================================================================
i. w" d7 z3 H/ s2 H5 n2 |5 bThe EnumFontFamilies function enumerates the fonts in a specified font family that are available on a specified device. This function supersedes the EnumFonts function.
( y+ @% t. U" E: U7 D5 c+ {( }+ qint EnumFontFamilies(
" D n) b$ x$ j3 } nHDC hdc, // handle to device control ! M7 L0 p |+ k3 {
LPCTSTR lpszFamily, // pointer to family-name string ( O. K9 D# Y; ?1 M/ Q8 ^
FONTENUMPROC lpEnumFontFamProc, // pointer to callback function & k! ^+ |" ~2 x5 J: b# T8 @& B( }4 W! }
LPARAM lParam // address of application-supplied data 5 Z! z% Z" U# f0 ]1 a
);8 z/ ?7 j) z3 ]) r% Q2 v
6 _7 [$ @: U# S; i& D4 Q. W% s
Parameters
% A" |1 h3 `+ j$ C' mhdc
' q: T9 g1 e4 w/ YIdentifies the device context. 0 m8 i* ~- `. {" n) C
lpszFamily
5 Q& p: t# ^/ C7 x1 {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.
7 @" L* S4 s p; U" m. olpEnumFontFamProc
- V! f2 c3 b5 X) W# S* `9 d `Specifies the procedure-instance address of the application-defined callback function. For information about the callback function, see the EnumFontFamProc function. - |& E/ g& C* u/ X N# e# Z1 @ R
lParam
3 M3 g9 _+ A# u. W0 L# FPoints to application-supplied data. The data is passed to the callback function along with the font information.
: a- [2 o; S% z9 m- h* }/ C4 S7 {' `+ Q6 @& s
Return Values$ C3 @# E; @0 f- P
If the function succeeds, the return value is the last value returned by the callback function. Its meaning is implementation specific. ; v! R* g' _9 r% B- I" c# W2 G) o) a
=============================================================================$ ~7 W, V( M# @7 N0 f. f
The EnumFontFamiliesEx function enumerates all fonts in the system that match the font characteristics specified by the
& Y& { w% `4 u6 M& w' H O, ^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.
& S& O- f# {) x) x' U0 R! C7 k1 M" z* | G" X' k+ s1 E, c# W
int EnumFontFamiliesEx(
# r* M! N' f# `, JHDC hdc, // handle to device context- W/ ?0 p" _. w+ v
LPLOGFONT lpLogfont, // pointer to logical font information
6 x+ X: w$ S" {% a8 X2 L0 tFONTENUMPROC lpEnumFontFamExProc, // pointer to callback function
( J$ ~4 u2 i) jLPARAM lParam, // application-supplied data3 V T h' M4 |' |4 Y4 n& r* N
DWORD dwFlags // reserved; must be zero9 v3 O% P) B- v: [. ~. q/ ?) `
);7 w* `" Q' c: U/ ?- S$ X
=================================================================================; H3 h6 `/ U) T+ }! y, Z* S6 i2 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. . ^7 N+ J" |0 g
This function is provided for compatibility with earlier versions of Microsoft Windows. Win32-based applications should use the EnumFontFamilies function.* z9 |! F# R. {- N' O
( M8 s/ j3 e* V4 R1 ]8 Uint EnumFonts(5 m' p, t7 G2 V7 I0 O
HDC hdc, // handle to device context 4 I" V, x3 a: L3 x' Q9 H* l) `# q
LPCTSTR lpFaceName, // pointer to font typeface name string
m8 e) C t; G$ f! d- MFONTENUMPROC lpFontFunc, // pointer to callback function 6 j% L, M& O7 h+ M) P
LPARAM lParam // address of application-supplied data 5 | ^' X: U4 ?% @
);
* x k$ \- ~4 g. B6 x) Z* [& `; `: j4 a6 D9 ^' {5 m
Parameters, B; o: u+ S0 ^
hdc S5 n4 G! l2 U$ I! H6 U8 Q, _/ y8 U
Identifies the device context.
% {% U U1 q0 c; Y. t, ^# flpFaceName( ^- ~6 E! ~2 a: U) e% P
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.
, I- A O. D% \4 a) J% ^. a/ h. dlpFontFunc
- [% i- z7 B* |Points to the application-defined callback function. For more information about the callback function, see the EnumFontsProc function. : w9 x- L; r2 A& K: } h" Q
lParam8 b* x" F6 U1 o& y; V+ K! b
Points to any application-defined data. The data is passed to the callback function along with the font information. e7 K0 J8 q; l& W8 \# ~" `
3 X7 u5 q0 x! p6 Q. o4 O- ~- B8 f+ u" o
/ j& L* I& T6 |2 u6 \: zReturn Values4 U6 S6 Z+ m. ]. d5 u
If the function succeeds, the return value is the last value returned by the callback function. Its meaning is defined by the application. " T* |1 h- M+ X% b& k* Z! m0 N; d
======================================================================
; N7 S6 S! p& f8 ]1 bThe GetSystemDefaultLangID function retrieves the system default language identifier.
, U7 }+ e7 S) E8 W; ?: ~2 j0 v. W: q& o. U. D2 D3 ~ \% e
LANGID GetSystemDefaultLangID(VOID)
% c# ~, G0 R7 w! A3 n( v' T" t" p4 v
Parameters0 \. N+ Q5 C9 p* P
This function has no parameters. ( s) }$ E) @9 Y# B! J* {/ i
Return Values+ t3 x: V% n1 e* x
If the function succeeds, the return value is the system default language identifier.
* f& { t2 T& c d4 |7 B================================================================================
% ~: ?# L: I6 bThe GetUserDefaultLangID function retrieves the user default language identifier.
1 ^7 D3 X" V! ?: a- Q" y; q
. k& e. m' |8 {6 KLANGID GetUserDefaultLangID(VOID)
e$ s2 u4 M" R/ F3 S% m' P
& Z1 b* C5 b- e: @( YParameters7 j3 n3 j8 H8 G& b) X* F6 B
This function has no parameters.
/ d' \% u* |! L. oReturn Values
' E) x3 r' t& O: _( _4 Y8 GIf the function succeeds, the return value is the user default language identifier.
! ]1 J5 Q5 T: r: ]================================================================================
' Y3 S- k* r4 U( ]% W$ ~8 u/ R7 B3 ]/ S' W
BOOL GetStringTypeA(
5 b5 K* q# f4 r; y$ d2 a1 Y$ I+ E2 Y0 {
LCID Locale, // locale identifer
. Y) E/ d! L4 C4 T5 EDWORD dwInfoType, // information-type options + a% D" n. A+ a
LPCSTR lpSrcStr, // pointer to the source string
4 t4 L: p4 V) }# q* Cint cchSrc, // size, in bytes, of the source string
- Q9 G" ]+ p4 _" c7 qLPWORD lpCharType // pointer to the buffer for output
5 C1 @/ t1 l: O6 ~% p$ @6 v);7 f# j4 l$ c' o( {7 V/ H4 g8 H9 o
Parameters
) G1 p" r/ F6 tLocale
7 g9 B! j' x4 fLOCALE_SYSTEM_DEFAULT Default system locale X- |" q8 v0 z" A2 y
LOCALE_USER_DEFAULT Default user locale$ v, s) n# F) Q7 Z
dwInfoType
8 T) f" k. t8 d1 c/ {) X- v# M3 wCT_CTYPE1 Retrieve character type information.
8 k, t" U, o: k* N0 O& }# |/ h+ [CT_CTYPE2 Retrieve bidirectional layout information.
* j" v1 m( ?: E( J+ Z/ b; t) n8 T+ uCT_CTYPE3 Retrieve text processing information.; u3 u* B+ v% s( |9 @+ y4 l4 V, Z
lpSrcStr
/ D' s/ f8 E* O' J% VPoints 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.) r0 g( Q0 F! W: `4 G$ {
cchSrc
+ F, ]* n4 o' VSpecifies 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. - H n$ X- j& r6 `: C
lpCharType
$ f' Q3 `* ^5 a6 m( Q# OPoints 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.
/ d2 }( s+ C) q( j: Z$ b* |# o2 P+ \# s3 o" e0 z: w' J
Return Values
9 O f* D$ E$ \8 U" RIf the function succeeds, the return value is nonzero.3 e% t* J0 B$ k D7 x
=================================================================
: [% o4 ?9 M% M4 x; O) SBOOL GetStringTypeW(/ q* T7 a+ y2 p" @9 ^
5 G) ^( u$ W" W/ B8 ~8 C
DWORD dwInfoType, // information-type options : |* E$ m( Y4 ]: C& E2 n
LPCWSTR lpSrcStr, // address of source string ; ]4 M# \0 x. X9 |0 i* I$ V6 t; k
int cchSrc, // number of characters in string 9 {$ I |4 `" y" z& J8 l2 Y
LPWORD lpCharType // address of buffer for output
: r- q& B$ d# Z+ o);4 T2 u% t0 K0 C
==========================================================================3 j7 A1 m1 y8 Y
The GetSystemDefaultLangID function retrieves the system default language identifier.
1 d+ [6 h+ T8 u8 lLANGID GetSystemDefaultLangID(VOID)8 o% y: m6 P Z6 M& [: h% A! O+ O
$ }% A' t0 E' r' X1 Q0 A7 H! z, }+ ^. W8 f2 r+ v& Y8 {+ \
Parameters F0 h7 z6 s" F
This function has no parameters.
% T' W0 m- E5 |) j X7 [
) F) q; i8 S" L VReturn Values
4 X: W' Q- W+ [( A& g n2 ^% gIf the function succeeds, the return value is the system default language identifier.$ U) ?7 I* q- g" p/ h! x1 U5 D/ k
& E& u0 t& ?7 ]# N
Remarks
3 o3 u- Z7 E+ i* s9 c. u6 H7 qFor more information about language identifiers, see Language Identifiers and Locales.
4 W6 _/ |- b1 c! ~) x3 \7 Y===============================================================================
" \& {( C' [' x9 U" e" Iint WideCharToMultiByte(
) _. a2 _# u6 H) s& E+ A; s9 o) }* \6 A- N
UINT CodePage, // code page
0 Z2 u+ B1 |* E/ j' pDWORD dwFlags, // performance and mapping flags
/ e' q0 G) v* x! c+ t- X e- u3 kLPCWSTR lpWideCharStr, // address of wide-character string
4 _1 K/ N" b" F) j0 c# Kint cchWideChar, // number of characters in string 7 V2 {# A9 p" Y! m
LPSTR lpMultiByteStr, // address of buffer for new string
8 \3 c( I M x7 Zint cchMultiByte, // size of buffer % C1 p/ F% h' Q2 M
LPCSTR lpDefaultChar, // address of default for unmappable characters ; Y" \: u4 n) V9 [
LPBOOL lpUsedDefaultChar // address of flag set when default char. used
! o0 v3 T: F/ V); . U G' ?9 z$ F _4 F" z7 ^2 v I
3 f' H: ?( _0 M% ^$ W& g- `% K
9 o$ t4 V/ g0 w5 QParameters$ M- |) d9 q" A8 [9 L
. e* ^! P0 x7 L: B& ~CodePage
) D, H1 \! m- 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:
f1 i2 d9 O8 M& S' e
* |# \8 O3 ~' V# X; ?3 _Value Meaning$ `" j" m! R( l$ T/ e, _4 v/ H
CP_ACP ANSI code page" t- T( h8 C7 [( E5 y# M. A8 n
CP_MACCP Macintosh code page
3 g/ d J$ O/ Q: ECP_OEMCP OEM code page. a% \) B; O6 Q/ {6 C3 M
9 n E3 S0 k1 I" O
dwFlags# d* N/ H8 z& L
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:0 Z" a6 z; I8 c y
% S; e: o6 x! m/ T
Value Meaning
2 p9 ^; b$ x1 L$ M; v1 zWC_COMPOSITECHECK Convert composite characters to precomposed characters.
9 g d/ e# n8 d8 E7 U/ n3 O) QWC_DISCARDNS Discard nonspacing characters during conversion.0 B( I6 v6 I6 I- V0 g
WC_SEPCHARS Generate separate characters during conversion. This is the default conversion behavior.
# z! ~+ ?0 ?) D! C) mWC_DEFAULTCHAR Replace exceptions with the default character during conversion.8 G7 V8 ^# G% l& F
$ J9 `* o6 c4 Q3 G2 ?When 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 D, g' I' G% Q* Ee is the base character, and the accent grave mark is the nonspacing character.+ H- o9 u: X$ \/ a; D
7 q8 @- P2 U E- G
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.
; r! A8 f- f: A7 @The functions default behavior is to generate separate characters (WC_SEPCHARS) for unmapped composite characters.
. y+ `! d2 z* j! B& b" H4 @, q6 h9 {& ~7 Q/ i
lpWideCharStr
" c+ G/ S1 y3 V# k2 l1 GPoints to the wide-character string to be converted.
8 Z3 x1 @3 o9 [* L$ O, n) Z$ e( H' K% U0 y* h
cchWideChar
3 b/ }8 G4 M" Y+ T! WSpecifies 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.
- m+ f, H. {6 G3 u; ~+ h+ x! n0 C, Z' }9 z2 d& Z7 a
lpMultiByteStr2 T8 O" x9 L/ N+ U
Points to the buffer to receive the translated string. " Q+ ?! A* D- ^
) b* d" s: ~. t \7 ?0 I% A) F5 z
cchMultiByte& Y# I; r+ {* D8 V. U9 X5 Q6 \) t
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.)
; i8 i$ J8 a$ _' n: t
! y& p; I4 m: |! ~* O$ clpDefaultChar
; E3 V5 a/ r3 @. Z0 b& }4 IPoints 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. $ K6 D$ o5 I+ a8 D3 I
7 _" k0 |5 }, l7 |0 _. ]( Z
lpUsedDefaultChar1 ]( R- w, S: h( B7 @ U
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. 0 w- w- a& |4 s6 Q% O
- {5 f D, c9 A+ D; G8 i5 D
2 @1 O. @7 _1 P
: D& r( y, Z/ J3 Z* pReturn Values+ b- u% t$ X$ B, B8 C" Y: j$ I. ]
6 y8 m# L# A6 y8 b. VIf the function succeeds, and cchMultiByte is nonzero, the return value is the number of bytes written to the buffer pointed to by lpMultiByteStr. . K6 Y) j4 m" E' T& L _: d
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.
5 B, ]+ g U* @" HIf the function fails, the return value is zero. To get extended error information, call GetLastError. GetLastError may return one of the following error codes:- v( g$ I9 p% K
7 r g$ L5 P" s2 U
ERROR_INSUFFICIENT_BUFFER) p1 I7 E" L: ~4 D! H$ {# s, ]
ERROR_INVALID_FLAGS
. O; h @! ?* O/ N$ `ERROR_INVALID_PARAMETER |