字体、语言相关的API函数原型:. _/ e7 p: N O
* y: U, ^% L0 y1 N, L9 I' N
createFont 用指定的属性创建一种逻辑字体
/ L8 p; K6 g9 W7 b: I- d. e* McreateFontIndirect 用指定的属性创建一种逻辑字体 , {/ L# L: a% r$ g4 @. \
GetStockObject 取得一个固有对象(笔、刷子、字体等)2 L+ B! Q1 v: V# ^
: M5 g+ y2 G6 H0 U7 v, aGetACP 检取ANSI系统代码页的标识符
! d1 V: } ~+ f8 N LGetOEMCP 检取系统的OEM代码页标识符/ T2 B1 p/ J, g, o& _) _
GetTextExtentPoint 判断一个字串的大小(范围)(用于限制输入)
! K' d/ M, t0 E* D) D$ o' wEnumFontFamilies 列举指定设备可用的字体0 `0 \9 @9 }' R! O- M9 [$ N# y& p) i
EnumFontFamiliesEx 列举指定设备可用的字体
7 m4 g0 m+ ~/ W* }EnumFonts 列举指定设备可用的字体. ^* r* ?4 v+ n% V1 |% W
GetSystemDefaultLangID 取得系统的默认语言ID
5 @" m8 J" ]- A/ N- ^ iGetUserDefaultLangID 为当前用户取得默认语言ID
+ F/ T8 { ]* W3 t) h* YGetStringTypeA 获取ANSI字符串类型 ,返回指定字符串的字符类型信息1 ]2 C# ~) e% E
GetStringTypeW 返回一个Unicode串的字符类型信息
) X/ f- n6 Z! y0 mGetSystemDefaultLangID 检取系统缺省语言标识符
: ]0 C4 K- j6 v. b3 R0 |% F: ?: @+ CWideCharToMultiByte 把一个宽字符串映射为一个新字符串" e/ t9 p: M+ v' L, g
( s D; z% q0 @% B% f3 c
=====================================================================
% f* z7 B, P( o$ V% `& k
# n; m6 q1 O* m9 w+ b3 s5 _! W+ ^HFONT CreateFont(
; g* @! { y$ X6 `$ h- u2 r! v- v- l# z
int nHeight, // logical height of font 1 g: b ~3 a& v' q; `! o
int nWidth, // logical average character width 4 t% m2 r, N1 S) Z# U) \3 R
int nEscapement, // angle of escapement
0 u- G( s) {' U, }0 j- `int nOrientation, // base-line orientation angle
, c" J3 ]5 z/ |" u Aint fnWeight, // font weight 6 V, [& L8 z9 O# H, r
DWORD fdwItalic, // italic attribute flag 7 Y' w2 \1 X1 h* p9 R: O. G* i6 \
DWORD fdwUnderline, // underline attribute flag
# A" \0 r* `7 L+ f$ CDWORD fdwStrikeOut, // strikeout attribute flag
, e( X8 B6 d& A- V- }DWORD fdwCharSet, // character set identifier " D4 N9 P5 ~" y) B& u
DWORD fdwOutputPrecision, // output precision
; I* b' c; r+ m5 f3 C& L+ e" @DWORD fdwClipPrecision, // clipping precision
* ]+ j% w# b& z$ p7 o# fDWORD fdwQuality, // output quality 3 ^# \2 G( d: H
DWORD fdwPitchAndFamily, // pitch and family
c2 |& O0 m8 o$ Q' BLPCTSTR lpszFace // pointer to typeface name string + U# i9 e5 \: A. F6 M
);
* G' q( Q! q7 U/ |8 ~ n8 N: T! F0 A0 ?4 d5 w
==========================================================================/ ?( F: K3 ]4 x F$ i
HFONT CreateFontIndirect(
& {* |% e* B. A6 D, d' O% X7 V- n% m: k8 L6 K$ x
CONST LOGFONT *lplf // pointer to logical font structure / t2 w0 m+ z# D" |
);) V) y$ e+ g8 j, M( M
1 p0 p1 {( o: c9 s" g, m4 J3 i==========================================================================0 I& i4 R( V% X9 X5 H. G2 k0 t3 M
HGDIOBJ GetStockObject(* r" C5 t# f2 l9 D$ c: c9 D) a
: X6 B. t. u2 k0 `
int fnObject // type of stock object
( ` H4 ^. S& A( j);
( \1 X }: I: w4 n: C Z
5 L; h8 L5 `% ^! T
2 L+ v! {' E/ ^- s. HfnObject& b2 h, \1 o9 y6 ~5 d" M" f2 C
Specifies the type of stock object. This parameter can be any one of the following values: : H3 R" r) u& e& \: C" o& M& b
Value
2 i ]; H) r" X" @4.BLACK_BRUSH Black brush.
, I# m6 @8 t' r( K3 k! ^$ l3.DKGRAY_BRUSH Dark gray brush.( ~4 v# u4 k" [
2.GRAY_BRUSH Gray brush.& M. A0 }, t% l5 h2 g4 `+ d
5.HOLLOW_BRUSH Hollow brush (equivalent to NULL_BRUSH).- o+ j+ D( H; C2 G! {% A
1.LTGRAY_BRUSH Light gray brush.
# g+ z5 P- u8 t5 s5 I1 _5.NULL_BRUSH Null brush (equivalent to HOLLOW_BRUSH).& |( y& e- i% d+ D+ s
0.WHITE_BRUSH White brush.6 v) p. h9 i" p" p" z! d4 l) u
7.BLACK_PEN Black pen.
% o% S- R) ^0 \/ N8.NULL_PEN Null pen.
! m: e# g6 N1 Z H0 [6.WHITE_PEN White pen.
7 Y0 K* v4 d. [* y11.(0B)ANSI_FIXED_FONT Windows fixed-pitch (monospace) system font.4 A; ?/ p4 N6 s+ M" T; K
12.(0C)ANSI_VAR_FONT Windows variable-pitch (proportional space) system font.
5 [7 Y, W" j2 O' q0 a6 v2 J! X14.(0E)DEVICE_DEFAULT_FONT Windows NT only: Device-dependent font.5 Y k( P3 I: H+ T2 H) F
17.(11)DEFAULT_GUI_FONT Windows 95 only: Default font for user interface objects such as menus and dialog boxes.(一般选这种)
1 m/ w& O5 g) ~. v* i$ C6 C. K10.(0A)OEM_FIXED_FONT Original equipment manufacturer (OEM) dependent fixed-pitch (monospace) font.- X) P U4 D9 R% r
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.
" M( [+ Q! z1 W" d+ W- J8 \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.4 W( W! ]+ J6 B7 k" S l. W0 d0 L8 z' o
15.DEFAULT_PALETTE Default palette. This palette consists of the static colors in the system palette.# Q8 m: k" x; `
If the function succeeds, the return value identifies the logical object requested.
) r$ f* p: N' ]5 S6 oIf the function fails, the return value is NULL. . e% ~" G0 I9 M( d& L7 z8 l0 h
=================================================================================9 b; a1 D# e9 f
The GetACP function retrieves the current ANSI code-page identifier for the system.
5 b' d, L( A8 n0 \( s8 bUINT GetACP(VOID)& A- d E3 l9 ]) I$ D' r Q- W
% H* O% R0 Y' S' A7 |5 C- ] R
Parameters' W7 ~8 r, [& S1 h5 T9 R2 h
This function has no parameters.
7 }% r0 ^. E) sReturn Values
1 i' }4 V, {% H% v# @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.
g/ `- t: ]* I: S9 JRemarks
( i4 [9 x4 h6 \Following are the ANSI code-page identifiers: 9 Q( C. d* v8 s
Identifier Meaning g4 |* `/ V" w, I, z, |
874 Thai
( d7 Y9 D" B, {. d3 u( w932 Japan
0 n4 \7 u: D2 ?: F' }936 Chinese (PRC, Singapore)
' N: o% ?" I) c9 D( o6 ?949 Korean
: i( |/ f& P4 L& N$ I+ O- O2 ^. c5 ]: c950 Chinese (Taiwan, Hong Kong) & j) i5 B( o# E% r2 t
1200 Unicode (BMP of ISO 10646)
0 ?8 ~# g J9 M3 O4 S1 {* I* B1 N1250 Windows 3.1 Eastern European : I/ c* L5 A! X0 e
1251 Windows 3.1 Cyrillic" n! Y+ p* [: B
1252 Windows 3.1 Latin 1 (US, Western Europe)
+ @3 `% ^) F: \& O+ z1253 Windows 3.1 Greek7 ~/ \1 j7 Q$ k# ]& V* Y- I
1254 Windows 3.1 Turkish
1 o9 G3 n/ D" u4 E3 l1255 Hebrew/ I: R# ~$ ?- S" b
1256 Arabic% y, z: \2 N' q9 g+ N8 c( U5 J: [; C! d( W
1257 Baltic' U! @8 p) H' f2 Y6 u) l9 D) r
=============================================================================$ v4 b Y2 }. V4 h @
The GetOEMCP function retrieves the current OEM code-page identifier for the system. (OEM stands for original equipment manufacturer.) ' L6 ~" N/ P1 e& ]
$ r# V# ^/ T3 W9 T' gUINT GetOEMCP(VOID)
0 Q: ~ D- M. U/ [7 q
+ L7 [3 A1 t8 E' ]1 C& x5 _) \0 y5 g4 y, x/ L% g+ z+ d( u
Parameters8 _' N }, N4 S1 h m2 D' `
6 s; [8 ~; M; t0 J4 x
This function has no parameters.
5 I& G8 b; X+ ?9 D% U+ `* I
D2 L F c7 I2 k9 n# }, AReturn Values3 I$ V5 h4 U( \3 \ \3 ^
0 f" J$ j* K* |4 k7 |4 I0 j
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.
1 _. p) g7 {9 R/ D' V- }6 `9 U& g( F: T( i% m
Remarks. G4 {. v! R* q6 H* h, O) x
' N E7 \; @8 e0 ^4 Y
Following are the OEM code-page identifiers: 4 h7 }* J7 _) P/ M" f* n& N4 A$ Y
( `. `/ _- \' zIdentifier Meaning) i2 U$ ?+ u8 x0 d
437 MS-DOS United States- u+ L; g/ X' d4 I
708 Arabic (ASMO 708)1 l6 z' O8 J4 L% U: @" m: W
709 Arabic (ASMO 449+, BCON V4)5 C6 j4 _" S$ R6 d+ g
710 Arabic (Transparent Arabic) A5 ]; a0 I' C' g5 T
720 Arabic (Transparent ASMO)
9 e/ @; W& D! Q: V737 Greek (formerly 437G)5 l5 {2 g l% H/ r
775 Baltic
3 J" b& G- {, j2 q/ o$ n850 MS-DOS Multilingual (Latin I)( w: P% O' Y& i% X
852 MS-DOS Slavic (Latin II); `/ @* d/ w0 D# _& ?& w& ~" U
855 IBM Cyrillic (primarily Russian)3 v3 J- n8 `; y. l }# v3 x, ?
857 IBM Turkish
) V& V6 r- [+ ^: }. K, r860 MS-DOS Portuguese1 K5 o! k( o/ a, V3 g" u& @
861 MS-DOS Icelandic- B' h0 G% {* F% C4 Y; A$ W
862 Hebrew
- c5 d/ F5 U7 G4 w863 MS-DOS Canadian-French5 V4 R8 c: D& @% i& d/ ^$ E
864 Arabic
0 B5 I3 C) @, ^$ }( Q6 g6 J865 MS-DOS Nordic
# W# J5 ]$ ~- A0 j866 MS-DOS Russian (former USSR)
3 ?7 I8 k, M* I* }# q869 IBM Modern Greek
. L( s) y" c, o/ C3 t9 S* l874 Thai
6 X% K% Q: ?7 g4 j8 e932 Japan. h* n2 W* e- y9 F/ Q* O9 T
936 Chinese (PRC, Singapore)
6 N% b# @8 Y. D# E1 r5 H9 m949 Korean3 E$ x+ Q7 {: w6 `$ W; q% s: P6 w
950 Chinese (Taiwan, Hong Kong)
5 ?8 O- t: u3 b/ G; x0 S1361 Korean (Johab)6 d/ c8 I4 e5 ]2 [. _4 e2 N
===============================================================================) Q( A z3 G! L- t% J5 k. E |' f
BOOL GetTextExtentPoint(
: I- L3 j# L S0 r% u, `/ ^% j, X4 O; F/ n! |; `" t; X# H4 n+ I
HDC hdc, // handle of device context
# A( W9 H8 F9 KLPCTSTR lpString, // address of text string
' Z: b5 q9 P4 v( X, ?; \" J$ gint cbString, // number of characters in string 7 ^5 Y% b6 ^1 E! E1 }
LPSIZE lpSize // address of structure for string size 0 a" s, h: ^% u
);3 m9 I: j6 n% Z0 M4 m
===============================================================================
$ j7 e( w9 t) C1 b6 w! P; ?' gThe EnumFontFamilies function enumerates the fonts in a specified font family that are available on a specified device. This function supersedes the EnumFonts function. 5 h: u; x: v' G. b& [+ g8 \ b
int EnumFontFamilies(
; E8 j: m, p: W! g" K) A( P% wHDC hdc, // handle to device control
+ h4 d* l2 U( M: M; e% d' BLPCTSTR lpszFamily, // pointer to family-name string
0 W+ c" W' E5 l/ Z$ I! OFONTENUMPROC lpEnumFontFamProc, // pointer to callback function
+ ^; ]; G1 Z* e; K* q4 c5 nLPARAM lParam // address of application-supplied data
' |& j' }2 O, o* Y, C);
, b* W- |# z3 k; `0 Q% D" B$ x2 O# J
3 {9 l! i7 z+ DParameters" L4 P% u# Y& U1 `- P* k
hdc/ X; x W2 j" G5 Z; J0 d- S5 K1 O+ l
Identifies the device context. 8 O5 @& X" Z9 s/ c' x2 E6 \4 C7 y
lpszFamily
( l( e3 Z! H: i" X9 W# cPoints 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.
) s3 m2 \4 N/ AlpEnumFontFamProc Y1 T4 n( C: N1 p4 V. j
Specifies the procedure-instance address of the application-defined callback function. For information about the callback function, see the EnumFontFamProc function.
' \+ ~, }5 L1 j" glParam+ u: K# t! Q7 ^, h' F, s
Points to application-supplied data. The data is passed to the callback function along with the font information. , U9 Y }; N |
4 D: k6 E( [, V( i' d5 I
Return Values% C" }1 X+ u. K! {
If the function succeeds, the return value is the last value returned by the callback function. Its meaning is implementation specific. ( o/ |1 |- a: D k$ r
============================================================================= t; N# u8 M: n X& o7 f
The EnumFontFamiliesEx function enumerates all fonts in the system that match the font characteristics specified by the
u& N0 [4 I5 `3 vLOGFONT 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.
, m4 E% N" b0 }( g0 N h
h1 n: u% j8 C) c' Qint EnumFontFamiliesEx(
; C" D* b: G" [ _HDC hdc, // handle to device context
" \. \# k4 G$ o* J; VLPLOGFONT lpLogfont, // pointer to logical font information
6 Q, A. n% C6 o) B4 ~- g- Z( RFONTENUMPROC lpEnumFontFamExProc, // pointer to callback function3 F0 f7 h) }$ O4 n
LPARAM lParam, // application-supplied data
. ]5 t+ _0 w+ p oDWORD dwFlags // reserved; must be zero) R% }3 i8 ~8 s: f5 N0 K
);
0 H2 h7 p, Z2 L: D' j=================================================================================5 y* n' X0 h& F/ E: ]% r
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.
$ ]8 d+ E: t* F0 p! vThis function is provided for compatibility with earlier versions of Microsoft Windows. Win32-based applications should use the EnumFontFamilies function.
7 f" ?. z. ]0 V z) _1 `8 C: w0 z# G* z5 T
int EnumFonts(" e# h2 ]7 q/ d" p# e' u- i
HDC hdc, // handle to device context
/ c$ I+ q) m" t5 [LPCTSTR lpFaceName, // pointer to font typeface name string
# S& A! m( f3 ]/ o, pFONTENUMPROC lpFontFunc, // pointer to callback function $ n- b; m0 Z+ h) N4 j; k/ y/ G
LPARAM lParam // address of application-supplied data , t& @% k7 e+ ^' O& v
); 5 j; j: W1 R [4 Y3 w& e3 z
3 J9 F. T# c; }+ {0 ?' c
Parameters
$ p, t" }" w+ khdc( R3 l. n! G+ \3 g
Identifies the device context.
1 ]* s0 t( h IlpFaceName, ~* I0 U! F0 f$ o
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. ! T6 L% E: n' V& F# v
lpFontFunc5 R$ `5 A- a! a. a
Points to the application-defined callback function. For more information about the callback function, see the EnumFontsProc function.
" |, B" F$ J7 ylParam
/ i8 n+ S! e0 G- R4 J6 ?& r; }Points to any application-defined data. The data is passed to the callback function along with the font information.
, l8 I7 T; s8 p( L2 e6 }) _+ e$ R& G5 }4 X/ E4 ~7 j* |' I
& W' R" r9 Z6 ? |
Return Values
! l9 Q) x5 H) O& D" J" X% SIf the function succeeds, the return value is the last value returned by the callback function. Its meaning is defined by the application.
1 A' o- D. `1 U+ i4 L7 s R======================================================================0 q, F5 i+ A l' ?7 V# B( D
The GetSystemDefaultLangID function retrieves the system default language identifier. % Q. E. d( ]7 O: v
9 k4 N/ O6 O2 i9 k7 x( |1 s
LANGID GetSystemDefaultLangID(VOID)
' Q# X& [9 m0 N; R2 ]
! @+ ^# t! b8 i: A2 pParameters
! Y$ `2 }" K4 J: w( S& J# CThis function has no parameters. 6 { V* N8 y' ~9 |6 D
Return Values
* W3 R9 h, Q4 ^" [+ eIf the function succeeds, the return value is the system default language identifier.7 w: |2 D$ w) u. X7 G; x
================================================================================
, E6 @, f' }" ~0 } I4 y& Q; }The GetUserDefaultLangID function retrieves the user default language identifier.
1 j3 I+ U' n8 N# z& c! @4 Q' I: ~" N& |# n6 n* H! G* `) ]
LANGID GetUserDefaultLangID(VOID)* {# V1 Y, H4 z% @8 p; G
, V0 `: t' g! ?4 i: i QParameters
! ^% Y3 W0 r3 G* K! j4 HThis function has no parameters. 4 j2 o& ?5 w1 ]) z
Return Values0 g" V% I( z& A3 N- _
If the function succeeds, the return value is the user default language identifier.6 x& V V r! N2 c+ Z, {
================================================================================
: ]+ o) h0 P8 R; o. Z
' y1 R0 a5 D! gBOOL GetStringTypeA(
7 V* ]7 V# w& E& k( F( L4 }4 N8 h% x) E+ p H. x
LCID Locale, // locale identifer+ V) e0 e, q& }: X$ F* L2 _
DWORD dwInfoType, // information-type options
0 O" d1 \, O( W4 [& @1 xLPCSTR lpSrcStr, // pointer to the source string
+ Z% h: R, K7 tint cchSrc, // size, in bytes, of the source string
6 L; y/ M* k5 L7 S! ALPWORD lpCharType // pointer to the buffer for output
% _) C' v" g/ X- [5 _);" o7 K' f9 L; v, ~4 ?$ O
Parameters# `; ~3 \& H# I; `
Locale- E9 s g9 f6 X3 `
LOCALE_SYSTEM_DEFAULT Default system locale5 M" L9 R- }% T( f/ P0 @4 b) W8 P
LOCALE_USER_DEFAULT Default user locale
8 Z& ^, w! w% u! A" sdwInfoType3 I* m. P( f9 m z- b
CT_CTYPE1 Retrieve character type information.
* d' C+ K0 r6 X$ Y2 y4 bCT_CTYPE2 Retrieve bidirectional layout information.$ v& p8 z; @" A
CT_CTYPE3 Retrieve text processing information.
+ b0 a5 y+ T' X7 `! N# ulpSrcStr
% D2 n+ h4 W/ [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.
( g7 @, W5 T) {. \* K# r8 o% CcchSrc
|( N& M3 z3 k3 R4 bSpecifies 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. 5 _/ V5 n* d- N# B0 f
lpCharType
( M* Z9 L: f2 B+ W5 J- a4 H/ rPoints 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.
! L) j0 }) u) H9 {* k7 B5 S2 w) S& m4 D' K- w4 R6 s, s( _7 ^. N8 j
Return Values
- ?0 J; D9 {# ~7 lIf the function succeeds, the return value is nonzero.
9 [" o; Y& n U2 t=================================================================% G* O0 ^6 Z6 L, }0 Y$ \) }9 d
BOOL GetStringTypeW(
5 E5 m1 P' `# f3 ^
/ u; B5 @ o/ [7 iDWORD dwInfoType, // information-type options
4 }* S4 ^3 [+ \: _! nLPCWSTR lpSrcStr, // address of source string 9 C7 _, f0 k9 R
int cchSrc, // number of characters in string
( j( W* \+ b; @7 r) sLPWORD lpCharType // address of buffer for output
0 i& D( g# N( q);9 D$ c7 E2 b3 m
==========================================================================& X/ E, L u7 a+ }
The GetSystemDefaultLangID function retrieves the system default language identifier. % ~9 L6 L. j0 q) Y9 v0 ]
LANGID GetSystemDefaultLangID(VOID)3 \' z, M- d5 s: C* D
5 m/ R/ V8 S6 F8 c+ ~" m, X6 F; `. U; o/ F7 _3 ]$ C
Parameters9 B2 G; C! l/ F( t
This function has no parameters.
% A B0 @- |! T4 X% R+ B+ G( i# N5 A+ g
Return Values& W- f# L7 e9 p6 G! u. a1 ~
If the function succeeds, the return value is the system default language identifier.
6 w) I$ E y( ~. H4 ^7 E Z9 |+ p2 j/ p2 q R
Remarks; ]! `" Y3 w4 p" t' V: j3 }
For more information about language identifiers, see Language Identifiers and Locales.: _: u( I- d8 Q. ~: s! k
===============================================================================
8 \4 q3 K4 i" c p; o2 U$ fint WideCharToMultiByte(
7 K" Q4 e* N, i% [2 g! b5 c k+ G. A- b# b
UINT CodePage, // code page
+ Y/ |; [! f2 tDWORD dwFlags, // performance and mapping flags / V' y, k0 t4 ^
LPCWSTR lpWideCharStr, // address of wide-character string
) q; A; i5 X) N9 }* n3 `int cchWideChar, // number of characters in string 4 Y9 O2 L, l8 |
LPSTR lpMultiByteStr, // address of buffer for new string 1 ?1 F" C4 G7 x) z5 B
int cchMultiByte, // size of buffer
) N/ Q. Q0 y; XLPCSTR lpDefaultChar, // address of default for unmappable characters . {0 ?& N( @8 M$ j; t" Z
LPBOOL lpUsedDefaultChar // address of flag set when default char. used
/ f" [9 W8 |+ p2 w' n( `);
/ V3 G" g% Y+ Q3 s4 \& ?+ `5 v" G! q5 N( E4 g. u/ L( r/ Z9 C
3 l' _7 W/ q, [3 f- {' I" GParameters- z. D( f! H1 A" \- X$ M Y* w$ ]
' d% }, r y- s* e( V" [
CodePage
; f# t- L6 \8 j, s3 YSpecifies 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:
( @& K8 ]2 m# P" C4 Q- Q$ P, D2 ^0 G: ^( d9 k
Value Meaning1 L8 ]" s4 l5 b5 ?5 b3 J
CP_ACP ANSI code page1 R' j% _* ?- B$ y( g
CP_MACCP Macintosh code page5 v7 |: t, m- b \/ w! a4 X6 p
CP_OEMCP OEM code page# J0 A% z$ W9 j5 i; d2 l% o
, r( D7 i+ [4 Z% T$ {* ndwFlags
# z7 U" c3 R& S1 m5 V8 G# LA 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:8 L- I4 Z! Y! i1 ]- E& Z
: [. f6 z* o5 C1 B) {
Value Meaning8 h& L$ [1 L8 V' e& N0 f
WC_COMPOSITECHECK Convert composite characters to precomposed characters.
1 x k5 c1 x7 x. V# YWC_DISCARDNS Discard nonspacing characters during conversion.$ M( B3 I& I; u" y6 v
WC_SEPCHARS Generate separate characters during conversion. This is the default conversion behavior.7 {# P8 X( r$ t' c: A0 ^
WC_DEFAULTCHAR Replace exceptions with the default character during conversion.
$ z3 u! r( Z F4 H0 Z( R0 L. A# s$ N2 a: C1 k* u$ k
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 4 ^1 B; ?" a+ W
e is the base character, and the accent grave mark is the nonspacing character.
# b+ V' B' ]7 R# E3 w# p
" q8 n1 c1 m4 R) M {7 }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.) p8 `8 W0 t% a( W! ?# n6 d
The functions default behavior is to generate separate characters (WC_SEPCHARS) for unmapped composite characters.
/ ?+ {. i0 J9 O& W3 y
# \' m& t q* X9 [1 m9 S1 ]lpWideCharStr
5 o f" v# ]9 \' RPoints to the wide-character string to be converted. / h/ a j0 T$ J( Q; s
5 Z4 C1 S ~2 N! I
cchWideChar6 _5 B8 s7 t4 C& l" ?* y9 A0 t O
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.
5 k6 I8 c3 s' {4 G3 i! H9 `5 i6 F8 O7 j$ V/ @% R) |
lpMultiByteStr
% F0 R+ t! B) e$ E! a, G7 `, PPoints to the buffer to receive the translated string.
; Q0 l$ e2 K, H2 _7 Z* o) T) E) `, t0 s6 f3 Q6 n: D- Z
cchMultiByte0 c" E# s @) _) _' w/ u. E+ u
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.)
1 ^! Y7 o H$ j4 v: D: `6 \4 b9 O4 I9 }9 T* P
lpDefaultChar8 Z0 o* F7 }5 j: P7 V5 b6 f
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.
' ~; ~8 Z8 I4 I( |$ Q0 _. s
2 t5 ~1 G/ d+ B0 B" V" G! C. HlpUsedDefaultChar
# D7 ?2 c) |6 b8 E9 s; ]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.
8 p* b3 Y+ N8 L2 D: w
. ?7 I% Q8 T# \/ y! `2 ?% q$ [9 h/ V3 V( d& Z* Q
; b% z6 U |! W0 @, _& m: |
Return Values! c" F& \! M$ k! {4 E
; W J3 ^1 N/ a/ a- j
If the function succeeds, and cchMultiByte is nonzero, the return value is the number of bytes written to the buffer pointed to by lpMultiByteStr. & |/ }* g, _9 U8 U
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. " H% o5 n3 X0 t2 N" P3 N. o- z
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:
' l6 r, n/ i+ i2 X; H
9 L# z8 E% o- AERROR_INSUFFICIENT_BUFFER
) B) Y) r) b/ _+ YERROR_INVALID_FLAGS
9 K* h- `$ F5 h4 O3 tERROR_INVALID_PARAMETER |