字体、语言相关的API函数原型:2 q% P3 A4 T k' v
3 y$ S5 `- }) f9 V/ t; @7 CcreateFont 用指定的属性创建一种逻辑字体 3 {& ~& r4 s( n
createFontIndirect 用指定的属性创建一种逻辑字体
+ ^. N+ k- c5 i% g( N- fGetStockObject 取得一个固有对象(笔、刷子、字体等)
/ z( @5 n" J4 a9 G: j+ |2 K0 |( o% b( [
GetACP 检取ANSI系统代码页的标识符
$ N% F7 |- P% ?3 ?! ]# k- c6 |7 AGetOEMCP 检取系统的OEM代码页标识符! Q1 z/ w& N, f) X7 K, T1 W6 J
GetTextExtentPoint 判断一个字串的大小(范围)(用于限制输入)
' B& E; L% H) ?1 e( FEnumFontFamilies 列举指定设备可用的字体. [$ N a' A; c0 \
EnumFontFamiliesEx 列举指定设备可用的字体
8 [! J9 j- s1 D: O, m4 X/ k( I. bEnumFonts 列举指定设备可用的字体% c& ^3 s3 u% A5 T3 `8 S
GetSystemDefaultLangID 取得系统的默认语言ID 9 k: X& [% u1 w8 u7 Y1 H
GetUserDefaultLangID 为当前用户取得默认语言ID
0 \, ?5 V* D( D' J( _GetStringTypeA 获取ANSI字符串类型 ,返回指定字符串的字符类型信息( V! s. {1 O) B5 N2 \
GetStringTypeW 返回一个Unicode串的字符类型信息
2 @, j e9 U' z8 h7 P3 ~GetSystemDefaultLangID 检取系统缺省语言标识符. l5 K0 T2 V+ x; ~3 x$ g1 W* J
WideCharToMultiByte 把一个宽字符串映射为一个新字符串5 j# e) N+ z; X8 q$ ^( R! s) r8 }
8 {8 P) l: @9 |* F
=====================================================================0 j3 \/ u4 f8 `
3 v& v4 }5 B3 K5 i$ l( t/ j# \
HFONT CreateFont(% s" J0 S2 o- x" B/ U/ E
/ r9 a# i" F f& X3 } k
int nHeight, // logical height of font ' A* g% o2 C* u: r+ g$ p6 P# W
int nWidth, // logical average character width + r# P! z9 L' v
int nEscapement, // angle of escapement
) |$ q \0 D+ H* f2 j! s$ aint nOrientation, // base-line orientation angle
b: C5 D9 P- ^- s/ P4 hint fnWeight, // font weight
: P% e n4 h3 U! uDWORD fdwItalic, // italic attribute flag
5 d8 ^9 T: K' r! A; C( }DWORD fdwUnderline, // underline attribute flag 1 v N7 }. C" d) C5 v" A6 g
DWORD fdwStrikeOut, // strikeout attribute flag
, J- C3 |# K1 n0 }DWORD fdwCharSet, // character set identifier
" Z5 u3 f; ^5 P; KDWORD fdwOutputPrecision, // output precision 7 `" \' q2 r0 c6 u7 |$ \' e
DWORD fdwClipPrecision, // clipping precision K7 D: v" E* c) Y6 b
DWORD fdwQuality, // output quality
A p' e; u6 Q x; j& cDWORD fdwPitchAndFamily, // pitch and family * A6 j+ i8 O7 ^% ^0 |. @
LPCTSTR lpszFace // pointer to typeface name string
6 r- Q0 L& c Q);
9 o8 V. ]9 u9 j4 E5 w3 C% v% r1 j: J% Y1 a% q, R
==========================================================================& v6 | X4 _$ ?& G4 i/ K- }( y
HFONT CreateFontIndirect(
( T8 a* Z4 ?: t6 o- Y: ?
% R& h& ?. F9 Z" C- G L8 W6 tCONST LOGFONT *lplf // pointer to logical font structure ) w+ H4 Q& ^2 Y5 q
);
! {8 e- x! U9 ?; b; r
- Z* t% c! U# \7 }- ]; {( D==========================================================================) M! N+ e- b& {9 r$ m
HGDIOBJ GetStockObject(5 w! _- m: j; T* ^. m
) r. w+ A3 s; Cint fnObject // type of stock object
: i' j& r, s0 E. W);, q) x+ m/ r$ m2 T7 T: ~! F% P
1 u* H0 f2 e. G+ G5 M8 n, j. H4 `' x# w3 T, Y
fnObject
3 a8 ~+ r" j7 U/ i3 t ISpecifies the type of stock object. This parameter can be any one of the following values:
; F! N3 d, X7 A7 V9 @5 d. hValue 9 A) _( s, o( D5 V' G( |+ p% l9 v
4.BLACK_BRUSH Black brush.9 Z! j- C4 o/ }6 I: d) R3 I# Y# D
3.DKGRAY_BRUSH Dark gray brush.
, Y) m; g- i. w6 l! y8 D' [2.GRAY_BRUSH Gray brush.4 x: ?% f0 L. U0 r! U
5.HOLLOW_BRUSH Hollow brush (equivalent to NULL_BRUSH).; i! ?7 h/ `4 q: q4 w
1.LTGRAY_BRUSH Light gray brush.( W) E$ r# F2 x) ^
5.NULL_BRUSH Null brush (equivalent to HOLLOW_BRUSH)./ Q/ Y: @% k# P; G1 q+ ^, a
0.WHITE_BRUSH White brush.
* Q1 A2 Z; P+ [' n" A7.BLACK_PEN Black pen.
* b$ X$ t# |( \3 k8.NULL_PEN Null pen.
5 A, t) q: ~1 {- E6.WHITE_PEN White pen.
; V/ ~# w5 R! T/ y11.(0B)ANSI_FIXED_FONT Windows fixed-pitch (monospace) system font.
' d' g& w8 w. p" t& y6 N# N+ A6 G12.(0C)ANSI_VAR_FONT Windows variable-pitch (proportional space) system font.- A7 M2 O& Q: _3 a; |
14.(0E)DEVICE_DEFAULT_FONT Windows NT only: Device-dependent font.
: A/ s, g$ v. q' B/ W17.(11)DEFAULT_GUI_FONT Windows 95 only: Default font for user interface objects such as menus and dialog boxes.(一般选这种)% ~7 x: s h2 [) y! G0 ^8 z6 A3 T
10.(0A)OEM_FIXED_FONT Original equipment manufacturer (OEM) dependent fixed-pitch (monospace) font.2 Q2 P* C; o) _$ p- o5 u3 I
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.
4 C f# x5 q5 t; F M16.(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.
/ @, T4 r$ g7 m* }: P15.DEFAULT_PALETTE Default palette. This palette consists of the static colors in the system palette.* ]( F! O2 W5 C& n1 a+ C
If the function succeeds, the return value identifies the logical object requested.
, A7 Y# n) A6 E! `$ E9 nIf the function fails, the return value is NULL. # {. f% ^% o8 J/ H. \9 {
=================================================================================, {" F: l* V/ K: t/ B
The GetACP function retrieves the current ANSI code-page identifier for the system., C$ ]: M/ Z# L0 `
UINT GetACP(VOID)5 h* D: e0 x" L- F- W, j' G5 i/ i6 H
8 X* {/ l/ p" k {6 t+ B, B, V* x( P
Parameters
" q5 `. O Z) p9 t: B4 HThis function has no parameters.
+ B: ^% z! S g3 X6 @: x4 L. dReturn Values
7 i7 J$ k2 S- M5 MIf 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.
5 g, G w' L W. J$ g5 n+ z& SRemarks% B) C4 Y0 J3 Y/ M( ~: K( o
Following are the ANSI code-page identifiers: ' |1 C$ ]/ Y6 ~
Identifier Meaning( v7 g" q3 d- J) G' r
874 Thai
3 ^8 \0 \/ g/ S932 Japan( E' P/ E5 a, M+ \
936 Chinese (PRC, Singapore)
; E* U2 Q* C, r2 C949 Korean
4 ~7 M5 U# n6 D* O950 Chinese (Taiwan, Hong Kong) 4 j" S+ X6 L5 x" B1 m
1200 Unicode (BMP of ISO 10646)% a5 z* t+ Z1 ?
1250 Windows 3.1 Eastern European 1 }! `/ z/ y" [5 N5 s* ~
1251 Windows 3.1 Cyrillic
+ u+ }* f) W4 D" R* ^" |1252 Windows 3.1 Latin 1 (US, Western Europe), }3 ^: K. j, Z" @# z3 @1 q
1253 Windows 3.1 Greek" g' ?+ H p$ _* I8 y8 `
1254 Windows 3.1 Turkish1 b& A( n* m! R
1255 Hebrew6 i- j2 ?' J# q3 c
1256 Arabic
# H2 q4 {+ H1 Y! e/ n3 @1257 Baltic
# r! F( }0 u6 p: w# {* a5 B=============================================================================3 ]& ?7 }2 J& k( U E: e" O
The GetOEMCP function retrieves the current OEM code-page identifier for the system. (OEM stands for original equipment manufacturer.) 7 f ^& c4 y, ~$ D
- i' o9 L9 @ t$ }2 B j( o" o6 E
UINT GetOEMCP(VOID)" E+ P: P6 |& c7 M; G
% p. ?9 p" k$ |% W$ f% |! L; Q5 d( h
. o* y9 G% Y2 e, u9 rParameters
7 g8 @1 V1 X( K9 @
. z6 `/ A2 L' A3 GThis function has no parameters.
- B( X0 ]4 `1 U9 G I9 I$ @" ]7 v
6 d, K! v9 i3 e, U1 _6 NReturn Values
! Q- V$ d: O! u( c' ?3 f8 _- _# u5 R7 } u
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.6 r, D1 ?! X. @% u' ?1 I
; s# ^/ D, e5 w2 U/ yRemarks6 D5 A+ O/ \& ]2 w
/ @$ Z B3 w# H) S9 L% U2 C0 ?Following are the OEM code-page identifiers:
" O- U/ u, _5 p- f9 {/ e# _, k" w% Z8 s# T# R
Identifier Meaning
8 g9 q0 K3 R1 A; t. q6 f) `437 MS-DOS United States: d, D. b4 ~( G% M$ K* C, d
708 Arabic (ASMO 708)# W& ~0 y ?0 T: p1 T; t" r; n
709 Arabic (ASMO 449+, BCON V4)
/ ^- ]( E9 j# x8 |. M. h: i710 Arabic (Transparent Arabic)
' |. M$ T; `* ~# P4 ~% t3 V720 Arabic (Transparent ASMO)
# |6 H) u/ k' Q5 W- ^737 Greek (formerly 437G)( r2 N4 I9 _; H- }' z u1 q
775 Baltic; k8 y; s! o, L$ [
850 MS-DOS Multilingual (Latin I): N, x9 C, m5 `+ h- D& P
852 MS-DOS Slavic (Latin II)8 C! m, u4 Y. D" y. _* W
855 IBM Cyrillic (primarily Russian)6 H& B) r- ]5 O' M( h( j' e/ W
857 IBM Turkish3 L, d0 v* q+ @7 X7 \
860 MS-DOS Portuguese- n6 T( i. M3 ~( x! P: S# R
861 MS-DOS Icelandic/ v; u+ k2 r, a: K9 F
862 Hebrew( U6 h, S# M2 K
863 MS-DOS Canadian-French. d [1 ]1 y/ o2 R9 Q' | b
864 Arabic; w O" b- ~# A
865 MS-DOS Nordic- o' Z7 T8 P1 j& M. A2 _" c
866 MS-DOS Russian (former USSR)
; ~ r% k4 _3 J# w869 IBM Modern Greek4 X( ?9 i) c; O8 F
874 Thai) K+ j$ G l, S
932 Japan) {) F9 K! Y+ {4 n6 U
936 Chinese (PRC, Singapore)# a" T; p$ k" l/ {, U
949 Korean
* d7 h j' H, \$ [" j8 a950 Chinese (Taiwan, Hong Kong) # U' H0 z8 _2 |1 S& [+ t
1361 Korean (Johab)
6 M3 n3 s4 T4 v H+ V( Z* A& L===============================================================================& c7 U$ m' q1 `$ p' {
BOOL GetTextExtentPoint( c+ ]5 f% B( ]2 c5 n4 {
* q& d% B& ^. n( `. `
HDC hdc, // handle of device context ; e8 G1 k7 j. u- T1 _
LPCTSTR lpString, // address of text string
, p& y! E) Y2 F! pint cbString, // number of characters in string p5 K( w; k. n1 t* Z" {7 f
LPSIZE lpSize // address of structure for string size * b$ ?! T" V% q, U$ ^
);- c* N) G1 P5 ?2 B5 g |* ]8 B
===============================================================================
1 r# w$ O n6 I6 a) m: m1 ?! eThe 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/ u4 {7 T) ?# W7 vint EnumFontFamilies(
5 z! L6 ?( w& A [% I$ GHDC hdc, // handle to device control
2 b( V" | ~3 U( J7 p7 NLPCTSTR lpszFamily, // pointer to family-name string
& o" \: l( L2 M4 @. j7 g& z" ~FONTENUMPROC lpEnumFontFamProc, // pointer to callback function
$ I# s$ e1 S5 Q. I9 f9 r5 bLPARAM lParam // address of application-supplied data u- l1 m0 @/ q$ Y3 m
);# y; B* S$ @" z- W; R B. V: s* q
9 G! Z0 I! d7 Y2 l( B7 [8 L0 o+ \$ c
Parameters* i% {8 r; N7 U( g
hdc3 x2 L0 B: m I/ o: J! V: L
Identifies the device context. 9 I. w- n3 `8 @9 n- o
lpszFamily
$ L; k: F4 d5 X$ r! Y; c* RPoints 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.
* v/ @6 f% q# F0 XlpEnumFontFamProc3 q5 F% D9 Z6 s5 e" Y( w( _- Q% k; k
Specifies the procedure-instance address of the application-defined callback function. For information about the callback function, see the EnumFontFamProc function. % @$ Q% g: P2 x5 X" A6 V
lParam9 q" H2 |6 ^ Y" v, a% U* I% ?
Points to application-supplied data. The data is passed to the callback function along with the font information.
" c9 V+ \( L2 r7 G4 x& F4 t! r& ?- ?: X
Return Values8 L( t( Q* m$ l8 \& w' P
If the function succeeds, the return value is the last value returned by the callback function. Its meaning is implementation specific. ) f [( g& H: R1 E! j; x3 I4 S
=============================================================================0 z3 L( K) Y1 A! C, W
The EnumFontFamiliesEx function enumerates all fonts in the system that match the font characteristics specified by the
- d- r( c3 t5 ~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.
% B+ _5 _' E- \+ j: h [) s- [, n% y* [% T: o4 _( z, A8 P; Y
int EnumFontFamiliesEx(' e- ?( @. o; E: N W
HDC hdc, // handle to device context$ N6 c& v& e* a1 U
LPLOGFONT lpLogfont, // pointer to logical font information, I) D9 Q! C4 t7 @% d2 l. }
FONTENUMPROC lpEnumFontFamExProc, // pointer to callback function
" ?# w+ A/ A, y% oLPARAM lParam, // application-supplied data2 u/ _: n% Z" n
DWORD dwFlags // reserved; must be zero
2 |" d& U+ }: E& [' H);
, G4 ^/ `& t3 ?, o5 }: K Z6 k=================================================================================
! E9 B6 c* a& j" u' P u$ }* _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. q8 r. f. `; q7 L$ m
This function is provided for compatibility with earlier versions of Microsoft Windows. Win32-based applications should use the EnumFontFamilies function.
3 d* V" C8 O' \7 D& n$ h( f7 A7 F
int EnumFonts(
& [/ J2 T- j- n7 G( Y: G6 j# S# lHDC hdc, // handle to device context 5 P3 _ L1 y, \* d" g
LPCTSTR lpFaceName, // pointer to font typeface name string
! C. M4 i9 n! ~8 Q% ]) K3 b* PFONTENUMPROC lpFontFunc, // pointer to callback function 1 W. f! ?$ |% ]' f2 O$ X
LPARAM lParam // address of application-supplied data 5 H9 W! W3 w* J& }3 w W, ~' z
);
: w4 B8 \2 G3 [% k& |% g# E* ~
- U s; R5 N/ Q L4 ?1 wParameters- Y6 W' X9 N' Q* B
hdc
# ]' I/ I6 S9 p* s! m1 IIdentifies the device context. + c; Z* D9 g8 A L. [! [
lpFaceName3 @) I1 `+ [" l. K5 R; 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. ! U3 O6 ?1 h' t6 r
lpFontFunc" ?' s) X$ i; h0 m" _
Points to the application-defined callback function. For more information about the callback function, see the EnumFontsProc function.
5 j9 t, B1 c6 h" q. VlParam) m9 }2 b6 i( Z1 `/ f/ g
Points to any application-defined data. The data is passed to the callback function along with the font information. 8 S% ^# I) z% N# `
/ L* W' q$ B; Q+ P, v8 d) A) S& r- I! e$ ?, E* H2 T
Return Values# W# n [+ q* U+ g& V. S" l8 y! `, H
If the function succeeds, the return value is the last value returned by the callback function. Its meaning is defined by the application. / z) D8 i0 l8 M: c- \
======================================================================0 s! V& u9 O5 C# m
The GetSystemDefaultLangID function retrieves the system default language identifier. ; d6 Z% h+ L' v
: U" M2 [: m6 i5 CLANGID GetSystemDefaultLangID(VOID)
; k* ]$ P3 I+ h# D4 \' w' v2 [
Parameters7 s3 ~( r% j) \# E8 A
This function has no parameters. , V0 c$ q8 p) F
Return Values
9 r6 g3 k0 S8 [1 G" tIf the function succeeds, the return value is the system default language identifier.# H# G7 z2 l$ s! H
================================================================================2 c9 }8 B0 p* B# k- T
The GetUserDefaultLangID function retrieves the user default language identifier.
$ z5 N4 x9 P! x4 H' Z5 _; r5 D6 v! R8 @; ]2 |! y& Q7 r$ j
LANGID GetUserDefaultLangID(VOID)
: X% A2 |- S; ~ i2 _4 {" {4 u
I6 L# `% ~" z- y5 ?, B+ nParameters
9 H$ B% W& J. F4 p; e$ TThis function has no parameters. / S6 `* S7 j, J( k2 j* |- ]0 q
Return Values% ^" O8 e6 t. T0 B: z& @
If the function succeeds, the return value is the user default language identifier.7 s" W, w1 S2 O9 H# D. _6 H
================================================================================) Y2 p4 Z$ D# |; u9 ~/ K2 X1 W4 w
4 Q4 x% C8 ^0 G7 ]* X7 y0 k
BOOL GetStringTypeA(# E( {% C' r9 P- ]% |* r
6 ?8 h5 z- Y- s6 p$ v# \% QLCID Locale, // locale identifer
' S( C% u) O7 T ^/ D0 SDWORD dwInfoType, // information-type options . W1 P: r9 x9 d1 ?# R
LPCSTR lpSrcStr, // pointer to the source string 8 v2 ~( F7 O, ^7 B) v
int cchSrc, // size, in bytes, of the source string
8 B0 p: |2 d5 ELPWORD lpCharType // pointer to the buffer for output
; P5 G: ]* `% E# N" l# K+ e);
+ ~2 y% s4 l6 F% _0 WParameters
9 V }2 b8 `: F1 y( [0 i) K+ KLocale
- e/ }6 D ^1 x8 ^LOCALE_SYSTEM_DEFAULT Default system locale
9 q! |4 n# C( |0 e# h* K5 }/ CLOCALE_USER_DEFAULT Default user locale
! Y( {8 M& Y& Q: C2 T& pdwInfoType
) J! P4 G; x' U' p4 \5 k2 [CT_CTYPE1 Retrieve character type information.3 y; I! {: H4 p0 d
CT_CTYPE2 Retrieve bidirectional layout information.
/ o; u2 {5 @2 ~" TCT_CTYPE3 Retrieve text processing information.
8 j: A# ~) X& OlpSrcStr3 N- K. a8 G1 V; h' n
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.; g! o' `; K8 U' ^* N' E, u- ]6 ~
cchSrc
4 @3 c. b! k. E& J( ZSpecifies 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. * `. K2 {6 F7 V A
lpCharType
5 V" h, }- E2 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.
) f/ Y) F: V! H, h- I! v, C( V5 Z1 ~/ i$ B
Return Values- v8 O3 A( Z) ~, {
If the function succeeds, the return value is nonzero.
+ J& ^0 x* |; K8 ~=================================================================
0 T2 H. Z- h. V0 P% O7 E8 LBOOL GetStringTypeW(
- F4 o; T& H) w5 X- r* V8 Y7 z+ Z1 g; T5 O* q
DWORD dwInfoType, // information-type options 0 t: P: t l$ J1 j' B
LPCWSTR lpSrcStr, // address of source string
4 H1 C* u' J0 n5 f/ B8 b1 `int cchSrc, // number of characters in string / u4 j i/ g; S) J9 Y
LPWORD lpCharType // address of buffer for output
1 k, S1 N. R8 t) q);
% u+ K+ E7 E3 ?% [2 O# t==========================================================================
1 M) F. _) h- c0 ]# D9 ?# J ^The GetSystemDefaultLangID function retrieves the system default language identifier. ( b9 E! l1 N) w- e
LANGID GetSystemDefaultLangID(VOID)
9 d8 Z9 A7 ?4 \7 s5 J
) c% P; E3 f3 Y0 l4 k
0 G3 D( _0 v8 M) hParameters$ g* ]- v% m' t5 m: b; c: K
This function has no parameters. 1 V: P; _; X3 z' \0 d8 m
* o. C' G0 o- W) w) k6 {: {Return Values
" V. b( p/ r/ M+ ]' u+ GIf the function succeeds, the return value is the system default language identifier.
+ L; }) R! v! Z4 n5 D2 U
, U9 h; O) `. \# RRemarks, z8 a) e. y/ l' H4 T# o
For more information about language identifiers, see Language Identifiers and Locales.
+ f4 A) V6 u; ]! m: W: @) f* p===============================================================================
3 ?8 s6 i" S# iint WideCharToMultiByte(
% r4 h+ q! ^( L3 w, h" x5 N- Q* ?
UINT CodePage, // code page " s; @5 f1 W9 T1 q; p7 _! C
DWORD dwFlags, // performance and mapping flags 9 w+ z5 }2 D" Q1 P
LPCWSTR lpWideCharStr, // address of wide-character string + L# N* S. t n( b7 W
int cchWideChar, // number of characters in string
. d% c2 j% F4 g9 p) m' MLPSTR lpMultiByteStr, // address of buffer for new string 1 G; \/ k3 w: `5 G
int cchMultiByte, // size of buffer
) p2 d( f& Q! S) ?- FLPCSTR lpDefaultChar, // address of default for unmappable characters 8 L$ l1 z" C1 ?# b, f3 J+ C
LPBOOL lpUsedDefaultChar // address of flag set when default char. used 7 L" J f3 d- T; e- |8 {3 O
); , d7 w0 n( U! _1 y' d
' }3 u- {& {: Q! s9 ~
$ M8 e: o3 N5 t& i, b/ h8 jParameters
) b" Q. s% D8 J; M! Z/ l/ _( f' A1 r! Z( f, }9 O W
CodePage
$ D& d% p9 r$ x; }5 x- b4 OSpecifies 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:
3 g2 u% S( V: ~6 ]7 I, W/ x l1 Y# t: ?9 J
Value Meaning
9 _) W) H* v% ] SCP_ACP ANSI code page
$ O) J, E# C% `) R* S/ JCP_MACCP Macintosh code page- a0 T) i2 j0 \' m* I
CP_OEMCP OEM code page
. b X4 e" [2 X9 A: N- I3 P2 u' W, Q+ I3 @4 W" _* O. V* ?. Y' }6 [; S" y
dwFlags! w5 u4 Q3 J7 m( U
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:& R$ e# i; B ?+ i b3 ~/ i
% Q& c9 A2 w6 n2 `Value Meaning ]% C+ |+ H" o7 ~/ w
WC_COMPOSITECHECK Convert composite characters to precomposed characters.7 a+ p7 [+ J9 b9 j
WC_DISCARDNS Discard nonspacing characters during conversion.2 Z: J( k2 B6 e# b+ b" c
WC_SEPCHARS Generate separate characters during conversion. This is the default conversion behavior.6 L, [) U4 k8 |2 N6 N% T0 E7 ~
WC_DEFAULTCHAR Replace exceptions with the default character during conversion.
* J7 n& B* a# E/ @# ?! i1 c' C ]0 b3 `" H$ @8 |
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 1 H7 w; f7 g- L9 q4 x6 c
e is the base character, and the accent grave mark is the nonspacing character.
5 N7 Z2 j3 j% h' M: k0 V
! V% m: S, ~9 ~# |+ D7 G) t' rWhen 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.( N; a# R- |- O$ a @, l+ D
The functions default behavior is to generate separate characters (WC_SEPCHARS) for unmapped composite characters.
1 m5 P" U5 s$ T! v7 j& G
+ J9 K' @: N8 v8 ^3 ZlpWideCharStr
+ L1 M! P3 g+ t, ^4 v* u0 U4 j) XPoints to the wide-character string to be converted. + C# U6 A- c, x9 B5 U
- B4 Z8 r; D" u& |6 H- @4 c3 y6 e
cchWideChar
5 n. r T4 `- q) [3 P) n( nSpecifies 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. . b4 k* ?+ }/ \7 V- e
( @" ?* F* {' _+ zlpMultiByteStr' P$ s- E5 }/ Y6 V, T" m( F5 I* F$ Z
Points to the buffer to receive the translated string. ' F9 Y/ w" i" i. ^5 ~1 w* b
! n1 Y0 ~3 ?$ CcchMultiByte
; j) ~, C/ S6 ~0 {5 H8 qSpecifies 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.) * r, a* E- G+ Y9 V* V& B! Z
4 a0 ^; r) M$ @* r( M' ~lpDefaultChar
) H! }# ?! ?$ f6 Y% _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.
$ g, _5 m. K9 ^+ {% ^4 ]' v
& m0 n7 m" Q$ A* mlpUsedDefaultChar
t! R7 P' _' I9 s6 F8 dPoints 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. # s! s( x, x2 E/ E
3 \8 A p( {$ a6 F6 H! H4 x! K
4 x5 n, l: m6 r6 O# d- \
, I2 K. E; T! e. w; x# c/ CReturn Values8 p2 F5 a6 L2 w! ]( ^# E( e
' Q( n/ j* n, P" |1 a) b s2 UIf the function succeeds, and cchMultiByte is nonzero, the return value is the number of bytes written to the buffer pointed to by lpMultiByteStr. 7 N& c$ M( s! R; i
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. # |" |$ a* g9 P* _" }
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:
$ N2 {: G3 F7 X' ]$ d, T1 K9 D& C' K( l1 e% i
ERROR_INSUFFICIENT_BUFFER. o3 Q. ^+ d$ d6 N5 ]4 a
ERROR_INVALID_FLAGS
) A' z- Q" n3 I. n* O" K5 C8 ?) mERROR_INVALID_PARAMETER |