冒险解谜游戏中文网 ChinaAVG

标题: 【汉化资料】字体、语言相关的API函数原型 [打印本页]

作者: shane007    时间: 2009-1-16 21:42
标题: 【汉化资料】字体、语言相关的API函数原型
字体、语言相关的API函数原型:3 k/ i9 M% N* z' R) ^

$ \4 o! m4 d4 @: JcreateFont 用指定的属性创建一种逻辑字体 ; U. k: Z: j$ ~# }  Z
createFontIndirect 用指定的属性创建一种逻辑字体 , S. m3 E( o+ J% b, [3 @
GetStockObject 取得一个固有对象(笔、刷子、字体等)' L" E7 |& }1 v; E2 ]

( Y& `0 W# W2 E5 O3 nGetACP 检取ANSI系统代码页的标识符  c: K3 \2 t- }" t* M: W; R& s& Y( Q
GetOEMCP 检取系统的OEM代码页标识符/ O, h! K; _. y% V
GetTextExtentPoint 判断一个字串的大小(范围)(用于限制输入)9 X' M0 _  i1 o/ x
EnumFontFamilies 列举指定设备可用的字体
1 r7 D& U! z1 X/ U. h  DEnumFontFamiliesEx 列举指定设备可用的字体
! ]' S3 e- V) {& i: dEnumFonts 列举指定设备可用的字体
, c" p; }. U0 n' N3 nGetSystemDefaultLangID 取得系统的默认语言ID / W$ E# I# h2 m8 I
GetUserDefaultLangID 为当前用户取得默认语言ID. d. b! n6 S' @; C
GetStringTypeA 获取ANSI字符串类型 ,返回指定字符串的字符类型信息# ?0 m2 e( w9 S0 v- l
GetStringTypeW 返回一个Unicode串的字符类型信息3 a4 U  U- |! q0 k
GetSystemDefaultLangID 检取系统缺省语言标识符
8 m2 n- B2 W# b, L! n. zWideCharToMultiByte 把一个宽字符串映射为一个新字符串
# ^& B6 P' n3 q; `' n8 P5 X
6 n- B  Y* w  G- H: B=====================================================================$ H$ s  a6 v( X. D1 V- A

; F/ [5 j# F& y( X" X: I) [: lHFONT CreateFont(
- R& U3 x, P4 v* [, }6 Z* a
- `' C$ {! d; u" @int nHeight, // logical height of font
% s3 L  p! f# d* p6 F& qint nWidth, // logical average character width
, X5 ^1 V9 B& N% Kint nEscapement, // angle of escapement & v5 }5 b" X1 K! a6 U
int nOrientation, // base-line orientation angle - n$ `$ \, D# _# r" |
int fnWeight, // font weight # g: {- f2 X7 [/ O0 H7 K  Z
DWORD fdwItalic, // italic attribute flag
" _& ]  B) M  O5 vDWORD fdwUnderline, // underline attribute flag 7 K( d; G+ \' ~4 o. P
DWORD fdwStrikeOut, // strikeout attribute flag 7 M% n/ M  q1 D; O6 y6 N2 }5 L
DWORD fdwCharSet, // character set identifier
6 h' U" h/ M- U' EDWORD fdwOutputPrecision, // output precision
: F7 q3 l4 S1 Q, fDWORD fdwClipPrecision, // clipping precision - F. y: r2 J& Y, G: z8 V
DWORD fdwQuality, // output quality # F* o5 G- \  |/ \
DWORD fdwPitchAndFamily, // pitch and family
1 o7 e/ }; ]5 T  t. ?% rLPCTSTR lpszFace // pointer to typeface name string 9 `8 ]9 N3 m/ ?8 F# }
);
; {5 g/ I  z0 R! M2 s7 U
: L+ z+ P' C* r==========================================================================- U2 z/ R8 i6 ~- e9 Q
HFONT CreateFontIndirect(
- l; d5 x# J" I1 D: k* G7 M3 `6 r' e1 `) X- g) L/ t! Y
CONST LOGFONT *lplf // pointer to logical font structure 4 K) b; k! P- B$ R
);
2 \4 d* G. C' B  |# B
8 S# o- f( D  c" r/ F+ A==========================================================================
2 _( S# e' m/ R0 b' O) V' n) wHGDIOBJ GetStockObject(6 X; q" X, d1 |! I9 u
9 C- s$ g- L" Q7 `3 U2 G/ M$ i
int fnObject // type of stock object
% ?# ^) `. M3 B! U) K. J);$ N+ a. z% j2 t

; l7 J4 U$ ?; i$ P
, f% }: b$ p3 f! r! A2 ]* n0 OfnObject% _4 o7 K7 Q+ v2 T& H' ~; N7 C
Specifies the type of stock object. This parameter can be any one of the following values: 3 n: R) e( L. Y
Value
4 {+ c  a. _& d0 X4 i+ W0 _& V) w" U7 q4.BLACK_BRUSH Black brush.
# C1 R8 x3 O  Y+ v) S1 Z6 q3.DKGRAY_BRUSH Dark gray brush.
: L* t5 S6 N( u' M' T  I7 h2.GRAY_BRUSH Gray brush.
  u5 y3 x/ a+ |; E" F0 _2 ^* B5.HOLLOW_BRUSH Hollow brush (equivalent to NULL_BRUSH).
' p2 S  I; w! ], B" J, |+ z5 H1.LTGRAY_BRUSH Light gray brush.
( i& Y) [/ H, d' Y0 B& r5.NULL_BRUSH Null brush (equivalent to HOLLOW_BRUSH).9 r# j+ X& H# Z! I1 r
0.WHITE_BRUSH White brush.; Y7 V" ]! S$ ~1 Y5 U- K7 |9 K$ X
7.BLACK_PEN Black pen.
2 {4 [( n1 d3 @0 L* X, y0 b% y+ B' |8.NULL_PEN Null pen.
) K6 @9 s  B1 ~& h- j" W8 ]  A6.WHITE_PEN White pen.
. z; U, D0 D3 e) G. X11.(0B)ANSI_FIXED_FONT Windows fixed-pitch (monospace) system font.
9 ?% F: Z+ v/ L* R6 N& s12.(0C)ANSI_VAR_FONT Windows variable-pitch (proportional space) system font.
0 n) ?$ J; B1 @4 W1 U- g/ b$ Q6 t# {14.(0E)DEVICE_DEFAULT_FONT Windows NT only: Device-dependent font.
2 R9 s+ H* U; |# G% b17.(11)DEFAULT_GUI_FONT Windows 95 only: Default font for user interface objects such as menus and dialog boxes.(一般选这种)% q( @" K% b3 F/ ]: N- T7 v" p
10.(0A)OEM_FIXED_FONT Original equipment manufacturer (OEM) dependent fixed-pitch (monospace) font.
- e$ t' M3 I, w, \* T" O/ l/ b13.(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.8 ?& E) C2 \4 X  g9 F
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 D) {( d2 t
15.DEFAULT_PALETTE Default palette. This palette consists of the static colors in the system palette.: Z7 g6 o7 q& i5 z
If the function succeeds, the return value identifies the logical object requested.
" T, `1 l$ @- S7 k" V% sIf the function fails, the return value is NULL.
4 @! |  u4 {% `0 x! A/ t, N=================================================================================6 |% J& X% w8 B6 x- L/ j4 n# Y
The GetACP function retrieves the current ANSI code-page identifier for the system.
3 e* b& s$ J: F9 u$ T; f0 LUINT GetACP(VOID)1 z3 e+ H0 H0 O
: q. w% ]3 \5 F% r: F
Parameters3 ?6 z8 n1 Z# \/ p2 F. S. G1 L
This function has no parameters. & N  T  D5 c9 E* ]3 Y
Return Values
' b, |& q1 V6 j, y9 C3 BIf 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.4 s# c' \- s5 t, u$ }
Remarks# p% y: s* n- Y
Following are the ANSI code-page identifiers: 1 N9 n+ x( A' q1 @
Identifier Meaning, z9 o, F% ^) y0 `" _
874 Thai
& t) M2 b. N- O5 K: p) H# c! h' G932 Japan; b2 h+ C- U+ V
936 Chinese (PRC, Singapore)# T2 [; m! p4 X" E: q
949 Korean
6 D! s9 w6 }, h) q7 ?5 w0 X950 Chinese (Taiwan, Hong Kong)
# @2 D: q4 o; a0 T- P- D$ n  [1200 Unicode (BMP of ISO 10646)* l  {# t* Q* G4 r+ F' I, ^4 W
1250 Windows 3.1 Eastern European ) c$ Y+ M5 N/ ^, f9 ~% H# J! u" |
1251 Windows 3.1 Cyrillic/ ]4 q, w8 l2 u: t
1252 Windows 3.1 Latin 1 (US, Western Europe)& z/ `. `0 y1 `+ |4 W
1253 Windows 3.1 Greek% C& y/ o* @4 w) J' w
1254 Windows 3.1 Turkish' |% N8 m+ o& T
1255 Hebrew. j/ s9 A. z' U! m% Q2 I& ~
1256 Arabic
  o5 a- ?9 I8 d2 X- g$ f1257 Baltic0 A$ p6 M. z5 ^+ v
=============================================================================
* n: q2 k, k0 A7 W# ^The GetOEMCP function retrieves the current OEM code-page identifier for the system. (OEM stands for original equipment manufacturer.)
, t5 c8 C, A9 G$ \1 h6 K9 i
6 w. }5 ]) D9 K! `' K$ CUINT GetOEMCP(VOID)# t; I* d+ f5 S" D' o8 a
, y2 E1 s+ J9 y+ y( W% i$ }

! @4 {- E  o- F. NParameters
! Y' p3 m0 q0 j# b' T! p' o- X+ ]' F' H4 ]
This function has no parameters.
1 |% C7 m" w4 u
4 ?, M9 j* \4 v5 Q( i6 EReturn Values! h( M& f6 [- ^* H( N

: Q  K% |6 M9 @# T+ FIf 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.
9 I6 z$ L& r3 h& g2 |
& J$ U7 T$ s# {- I6 wRemarks
0 X( @' S3 w' Y. G6 e! w
: U  Y9 I: O% o' GFollowing are the OEM code-page identifiers:
( S( z$ Y4 i  h7 F0 c' P% O& `2 L
' Q/ k9 d! p3 L5 ?; sIdentifier Meaning  P' f$ E" H6 Y! `- f. B, p( J
437 MS-DOS United States* O( u  {6 `5 @. x0 m/ i
708 Arabic (ASMO 708)0 }+ R. X6 J% I1 M* C4 g
709 Arabic (ASMO 449+, BCON V4), g6 k; \# G5 S. f3 _% c" G
710 Arabic (Transparent Arabic)" ]+ H, L) S+ ~) Z$ c  S
720 Arabic (Transparent ASMO)
2 R# y1 l' b( }+ I. |737 Greek (formerly 437G)3 z, P$ }- l; T0 e5 S5 [  z
775 Baltic: A" U+ w+ l+ g0 Q# K" W( y3 g
850 MS-DOS Multilingual (Latin I)1 Z! x8 L: \' z$ f
852 MS-DOS Slavic (Latin II)* q# {. ^' U. ~& {
855 IBM Cyrillic (primarily Russian)4 L7 u  F$ a; c9 T
857 IBM Turkish. f, T/ Y2 G  B
860 MS-DOS Portuguese
$ {4 d0 Q0 r6 ]# X' u! k4 L861 MS-DOS Icelandic
+ F4 ~' Y; I( z% j$ t862 Hebrew8 D" b- V3 O  G
863 MS-DOS Canadian-French
2 g, v! Q6 _5 p864 Arabic
& M2 C6 A' O& x9 z2 `; X865 MS-DOS Nordic
6 o5 A) \5 d8 W( Z# a* n866 MS-DOS Russian (former USSR)
! b- x# V  \( t* v0 }7 O& A869 IBM Modern Greek3 Y7 L0 X0 w; F* ^% |; e  z
874 Thai
( b) Z" z9 Y$ q- `9 I  y& T932 Japan/ u9 k/ M% L/ S9 N
936 Chinese (PRC, Singapore)
! |! i" I' N7 R7 ^* c0 k# r949 Korean
! Q9 p2 }) H! w3 c950 Chinese (Taiwan, Hong Kong)
& }3 p0 L" n1 b! ]' [& P2 [1361 Korean (Johab)
& Y# v+ X5 l  E===============================================================================
8 ?) _) n' m- V9 BBOOL GetTextExtentPoint(
1 c# N2 |* a) w  E) k  _' ?( S5 h7 _. `2 k, u( w
HDC hdc, // handle of device context
1 T# n% i6 B) w2 B3 aLPCTSTR lpString, // address of text string
3 v) Q( x- ~( O, c$ w' r$ N+ T: u8 n' L9 ]int cbString, // number of characters in string . v# B& S% _$ R3 j0 {  f3 r
LPSIZE lpSize // address of structure for string size
( }" k" R4 I( y6 Z3 D8 g' a+ g( q% _);/ M+ |4 y) u: N$ D- Z7 v; p  W
===============================================================================
, _& @- m2 f6 @9 ^. W) Z% \The EnumFontFamilies function enumerates the fonts in a specified font family that are available on a specified device. This function supersedes the EnumFonts function.
/ l6 F3 z3 Y% oint EnumFontFamilies(
: t, _5 H, u5 H6 @/ y$ dHDC hdc, // handle to device control
6 K" y5 [4 q% F" s& V# A5 |LPCTSTR lpszFamily, // pointer to family-name string
+ x. q& P0 o% N& r& bFONTENUMPROC lpEnumFontFamProc, // pointer to callback function
( R* S$ O) b' O8 ]; j. t9 fLPARAM lParam // address of application-supplied data
3 \' v# C& f; }& W5 I# f);) W: C6 P( R' e7 d9 T% u5 P; E

' A: u# [" S, @2 N" q5 I( VParameters, z! p- h4 P4 \% `1 Q
hdc: s. a4 ^$ E1 k& `
Identifies the device context.
" Q! w: B: M. a! f5 p4 blpszFamily
; \8 p2 S  R2 v" vPoints 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.
  R6 D" g$ |$ t* ^1 `$ t! m; B; olpEnumFontFamProc/ [+ q$ |1 Z9 ?8 q4 |% z; Q
Specifies the procedure-instance address of the application-defined callback function. For information about the callback function, see the EnumFontFamProc function. ! {( }' R, c  `% q+ t
lParam
+ l: u# n$ W6 {! q7 KPoints to application-supplied data. The data is passed to the callback function along with the font information. # g3 m, O9 R  `( G

; t, V# }+ H( jReturn Values
( k* a: s! |' ?- E( m: yIf the function succeeds, the return value is the last value returned by the callback function. Its meaning is implementation specific.   @" W! ^5 Y8 E+ u+ Y4 q
=============================================================================
* g' W* p# o& A2 G; T9 z7 _6 Q8 DThe EnumFontFamiliesEx function enumerates all fonts in the system that match the font characteristics specified by the : Y$ w+ ^& `3 M/ Q8 h9 r- D
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.
8 |) F9 [+ y/ n! p, _5 f
# F% W* [# T) z6 y! fint EnumFontFamiliesEx(
9 D6 v. f2 S- H0 [HDC hdc, // handle to device context8 w, M3 K3 ?3 Y/ _  m
LPLOGFONT lpLogfont, // pointer to logical font information
' u' Y* c# l( J1 r8 Q6 K; vFONTENUMPROC lpEnumFontFamExProc, // pointer to callback function
* i/ f" K7 `$ u1 yLPARAM lParam, // application-supplied data
: x! G4 I7 k% w( `% k! @2 yDWORD dwFlags // reserved; must be zero8 R+ i4 v) ^1 ?  A% \5 N
);
. j( D5 q4 o1 k3 [" T: U' Q=================================================================================
( `! `4 C6 l6 ~9 B7 mThe 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.
1 P$ Y7 Y& x) U' _This function is provided for compatibility with earlier versions of Microsoft Windows. Win32-based applications should use the EnumFontFamilies function.$ g% U$ X7 z3 s5 m

; s4 L8 y) b$ k- a& i) Y% @0 vint EnumFonts(
# L: L( N* C* @3 l3 A: t/ G- i9 `HDC hdc, // handle to device context
0 D& }9 G; @( M; o; MLPCTSTR lpFaceName, // pointer to font typeface name string
! R8 {, L& i( u- f3 r7 XFONTENUMPROC lpFontFunc, // pointer to callback function * N) V- }6 z2 I/ {8 H
LPARAM lParam // address of application-supplied data
. F3 l' J/ `7 F0 @6 P);
( x7 p$ c6 q+ M9 R" M' s; a$ ~2 ]7 Q. n$ r
Parameters# B$ U6 S& Q& H$ Q! d7 W- a
hdc
% s& O4 L5 o. U4 r* j, |' `Identifies the device context. * P; `0 T/ Q# [# R) w  ?
lpFaceName
$ a/ v  T/ C0 y6 B) 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.
/ w" Q( j1 h* J& KlpFontFunc( l, Z* D+ o1 l2 ?0 L) @
Points to the application-defined callback function. For more information about the callback function, see the EnumFontsProc function.
* B5 a9 v' U: p, ClParam+ c7 D0 f' F5 H/ w6 n; Z! ^
Points to any application-defined data. The data is passed to the callback function along with the font information.
( m  Q" ]0 G( F0 ]" l
$ c; G9 M) m- C. P" }8 Q7 r2 c3 d0 r) d; T/ M; T
Return Values* l, B# g3 R: e. H1 E4 J. I" t
If the function succeeds, the return value is the last value returned by the callback function. Its meaning is defined by the application. , l/ m% R* ~4 ]* l6 B
======================================================================
1 T# v1 k4 T6 \  p, O5 \+ l; aThe GetSystemDefaultLangID function retrieves the system default language identifier. 7 ~9 m1 ~+ d! a( V' J/ ~

6 ~- C: o1 ], A9 L5 iLANGID GetSystemDefaultLangID(VOID)7 A$ q& _; I* u) P' B5 N) ], _

9 l/ K6 D7 L- ~( Z# o. ?& mParameters
' x) V: @% n( u" L, a' c- uThis function has no parameters.   w$ V7 w6 D  G& I
Return Values
) `: D8 Z% }7 a/ eIf the function succeeds, the return value is the system default language identifier.
4 Q; L" c: r7 e& F- m3 d================================================================================
, @2 r6 O9 \% F; k6 UThe GetUserDefaultLangID function retrieves the user default language identifier.
* G6 B" K$ s+ Q  g5 ~- T% T% F8 {: M( [, P
LANGID GetUserDefaultLangID(VOID); E  t, e! `# a! V7 @6 c
; b, j+ B) V% k, z4 m; I1 }- J
Parameters8 z8 w' R, ~) m: E9 F
This function has no parameters.
0 _% F2 Z& _) |5 mReturn Values
& y; q- g  P, E; [+ D: yIf the function succeeds, the return value is the user default language identifier.
! g1 a2 p( K) Z( r9 I================================================================================
5 a/ J6 D' l7 j; w* Q$ T- I! I) b5 C  j/ T) r3 z" o7 o
BOOL GetStringTypeA(% ?+ t" @7 B  b
$ Q6 {% t7 k, T) v
LCID Locale, // locale identifer
  E* A1 _2 u' Q# GDWORD dwInfoType, // information-type options " a7 i3 l. p/ |3 x  x- _, c
LPCSTR lpSrcStr, // pointer to the source string
7 G+ M9 B* a5 a/ oint cchSrc, // size, in bytes, of the source string 6 g3 c! `0 D$ i6 \3 v) J% u$ o$ N
LPWORD lpCharType // pointer to the buffer for output
* S+ f6 V6 ^+ O4 M8 h! d);
8 ]8 k; C9 U0 S- W" YParameters) R& C# Q, k7 X7 _8 O% }
Locale
4 n/ L- ?* d3 \1 nLOCALE_SYSTEM_DEFAULT Default system locale/ i0 M& q8 r3 b, }
LOCALE_USER_DEFAULT Default user locale8 q5 Z+ V" o! D3 ], p+ q
dwInfoType1 K: K3 ?0 y, g4 O+ V) g5 q8 c) f
CT_CTYPE1 Retrieve character type information.
7 v5 ^$ L9 C, i! F- GCT_CTYPE2 Retrieve bidirectional layout information.
7 t1 e" g7 o6 u3 i, p/ sCT_CTYPE3 Retrieve text processing information.
# r+ `# O& A& {6 UlpSrcStr! U* e2 k; b8 H3 d; I& M
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" H1 K4 j. S! LcchSrc
- L$ x# u* ^& w) @0 {( Q. xSpecifies 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.
$ E5 C* i! L( m4 ?) n9 clpCharType+ k1 p5 i, {# A" `8 S7 _9 O
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.
2 \. z: I6 L2 H& n
0 M+ F" {# Q! O: {, L( gReturn Values
6 L* M2 t+ y4 I- JIf the function succeeds, the return value is nonzero.
% l, S, X3 P" C7 v2 y( b4 K=================================================================4 c: Z0 m* t4 b% U0 G1 E( U1 [  ?/ N
BOOL GetStringTypeW(
, n# x) c2 s3 K. {* f3 ?3 ~0 J' j
7 r2 k, z1 q, E2 g+ m% c. @DWORD dwInfoType, // information-type options + m, N! H) i; y8 {+ Y
LPCWSTR lpSrcStr, // address of source string
( F7 {; _" B3 j* cint cchSrc, // number of characters in string 0 X3 P7 ~# V4 [0 [( O7 A+ A
LPWORD lpCharType // address of buffer for output
; P0 w' T. `6 N$ D);% r. I. S/ G! N1 x# p$ R/ A
==========================================================================
  ~  }- s( o6 W* ]" J- rThe GetSystemDefaultLangID function retrieves the system default language identifier. $ K" j! g3 v% U$ `$ W/ `) P" T
LANGID GetSystemDefaultLangID(VOID)
! E- L% [- W- H  P. B
/ q7 Y4 O5 N7 q' h4 M9 V% d1 l
. c2 ?  o7 X) t8 A% f: PParameters1 `. |4 `9 o9 A/ Y3 r# L, S5 A) q
This function has no parameters. % L0 d4 r: U0 Y% w8 {, ^

% K# a1 B: o# o+ r$ WReturn Values: U, d. R! T7 w3 p
If the function succeeds, the return value is the system default language identifier.$ \+ h% ^" v4 X, h
) k: ~9 m' G2 \' d) y
Remarks
# r0 M5 N, X* WFor more information about language identifiers, see Language Identifiers and Locales.
" F; G7 Y3 a+ Q, ~/ i4 x; Q===============================================================================
) {  ]$ r1 t0 Y0 L- r  b' h8 jint WideCharToMultiByte(  v1 I, @) Y& M4 d6 m

( |( P0 C3 a! |% d( B. |; H, ZUINT CodePage, // code page
. p( |9 O% r$ fDWORD dwFlags, // performance and mapping flags
. U8 C. L+ r1 a* H5 fLPCWSTR lpWideCharStr, // address of wide-character string
& s; \, P, S- x* T' rint cchWideChar, // number of characters in string ; U0 M5 [' U/ w  D/ T" r) K
LPSTR lpMultiByteStr, // address of buffer for new string 2 O. G; x; R1 O3 I
int cchMultiByte, // size of buffer + @7 W( {2 z8 g* ~
LPCSTR lpDefaultChar, // address of default for unmappable characters % e0 _4 w8 R0 b  [" W
LPBOOL lpUsedDefaultChar // address of flag set when default char. used
- l* [1 `" d: Y, `& U% |3 `);
2 g4 {% F$ ^1 f9 i9 k4 t' h, s8 P, T, g
# {' K; ~; F; c, y5 T8 f6 H* `* h1 E5 d0 m; G# N
Parameters
  P5 B9 r: t. X' F7 o) k' M4 S
, M& l6 e9 |5 [' `: F0 UCodePage
7 n. t" t% ^7 {, c' }- _Specifies the code page used to perform the conversion. This parameter can be given the value of any codepage that is installed or available in the system. The following values may be used to specify one of the system default code pages: : G: c# W8 X! L6 H' |# X, N6 k

3 J) g! ^$ Y6 b0 \. d) l1 D( _7 cValue Meaning
, c1 |. c+ h$ S" [4 R& UCP_ACP ANSI code page' g9 Q% H5 o. ^- N6 M4 }5 y
CP_MACCP Macintosh code page
0 V! W. B4 ~5 D" wCP_OEMCP OEM code page
; l- I8 |% w8 y: Z1 Q: T4 p0 B: P! i/ b. u; F, U0 O
dwFlags
4 c5 G5 Y' ^- F/ w+ s) Y$ QA 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:+ U* v, L  k& d! }

- S: f/ b4 Y' s& f# S" ~$ Z1 K8 VValue Meaning( a* J& t, i; o' d8 X7 j/ |
WC_COMPOSITECHECK Convert composite characters to precomposed characters.
+ P, d5 U0 @+ _1 |1 {WC_DISCARDNS Discard nonspacing characters during conversion.5 b6 v! ]. ]+ F3 O. F% B0 a
WC_SEPCHARS Generate separate characters during conversion. This is the default conversion behavior.
  y$ V. Q; z2 b, ?$ o0 tWC_DEFAULTCHAR Replace exceptions with the default character during conversion.$ t% }  ]7 u; l/ m9 W0 e7 G
/ ~: d+ [" @4 o( w
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
) s! c* ^# x9 Ue is the base character, and the accent grave mark is the nonspacing character.
: G/ x+ F2 K3 y0 [  i
) a  |& Q3 }9 {1 v- mWhen 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 I% t( `8 U, T, EThe functions default behavior is to generate separate characters (WC_SEPCHARS) for unmapped composite characters., V9 I0 P' T; [4 V; }$ N$ p

0 {1 i9 }: b, Z1 `! z0 ElpWideCharStr; o) C( I0 @1 ~6 T% B% a$ Y
Points to the wide-character string to be converted. ) M  o+ ?4 e" p9 x& I3 T" q4 D

- j4 Q, \6 h6 B0 ?3 ]! qcchWideChar
' F4 ?$ b3 o0 f' A7 `" ^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. , n4 @4 z' k* l: G1 O

/ a- }6 d4 A0 G2 u! olpMultiByteStr
9 m2 c  `3 ^( BPoints to the buffer to receive the translated string. . l1 u9 C/ Q+ C" _/ j* ]/ x9 g" C9 J
5 ?; n5 a! p5 ^$ G' Z4 a
cchMultiByte
4 d0 s; i( ~  D% l9 DSpecifies 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.)
3 R0 y6 u5 H4 `6 P+ g( j. }/ l$ q; [! @( K+ a+ g' O; y
lpDefaultChar
; G% m* ?6 \8 {3 Z! aPoints 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. ; l5 H4 K; y) P. @5 y
: D2 }, _* X; n
lpUsedDefaultChar7 d% J+ _& Y) N# G7 Y5 z
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. ' |6 o% q$ |1 o) S! H  a7 `9 U+ f
& V; I4 T7 j' J2 E6 O8 a

" Z2 F+ R# c" {
* u% m7 {/ a1 v- K1 {7 yReturn Values& X( I- c0 @/ M; V

- K2 y; n. w) ^If the function succeeds, and cchMultiByte is nonzero, the return value is the number of bytes written to the buffer pointed to by lpMultiByteStr.
' ]2 q$ n- H9 v1 dIf 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.
) w8 ^- d0 w( ~) y6 K' EIf the function fails, the return value is zero. To get extended error information, call GetLastError. GetLastError may return one of the following error codes:' E* v, U( @3 \& P: u7 ~
5 ]% k. |4 K0 d3 Q
ERROR_INSUFFICIENT_BUFFER5 z& ]  [9 X  _
ERROR_INVALID_FLAGS5 I5 R8 t. x; ]; y1 z! V* P( Y
ERROR_INVALID_PARAMETER
作者: uranus1997    时间: 2009-1-21 15:26
有应用实例吗,这样看比较累,水平不够 [s:5]




欢迎光临 冒险解谜游戏中文网 ChinaAVG (https://chinaavg.com/) Powered by Discuz! X3.2