网站首页  词典首页

请输入您要查询的函数:

 

术语 getstringtypeex
释义 GetStringTypeEx
语法:
BOOL GetStringTypeEx( LCID Locale,
DWORD dwInfoType,
LPCTSTR lpSrcStr,
int cchSrc,
LPWORD lpCharType
);
GetStringTypeEx功能
检索字符类型中指定的源字符串中的字符的信息。对于每个字符在字符串中,该函数设置在相应的一个或多个16位位输出数组元素。每个位确定了给定字符,例如是否字符是字母,数字或两种类型。
与它的近亲GetStringTypeA和GetStringTypeW,GetStringTypeEx展品适当甲或W通过的#define的UNICODE开关使用的行为。这是推荐的功能。
参数
区域设置
[in]指定的区域设置标识符。此值唯一定义ANSI代码页用来翻译所指向的字符串从ANSI lpSrcStr为Unicode。该函数然后分析每个字符类型信息Unicode字符。
此参数可以是一个区域设置标识符的MAKELCID宏,或下列之一创建预定义值。
LOCALE_SYSTEM_DEFAULT
默认的系统区域
LOCALE_USER_DEFAULT
默认用户区域
dwInfoType
[in]指定字符类型信息的用户想收回。各类型分为不同级别划分(参见资料列表下面的备注部分包括在每个类型)。此参数可以指定下列字符类型值之一。
CT_CTYPE1
检索字符类型的信息。
CT_CTYPE2
检索双向布局信息。
CT_CTYPE3
检索文本处理的信息。
lpSrcStr
[in]指向那些性格类型的请求的字符串。如果cchSrc任何负整数,该字符串不是假定为空终止。
cchSrc
[in]指定的大小,在TCHARs,字符串指向的lpSrcStr参数。这是指对函数或Unicode版本WCHARs ANSI版本字节。如果此数包括终止NULL字符,则函数返回字符终止空字符类型的信息。如果cchSrc任何负整数,字符串被假定为空终止的长度计算是一个终止NULL字符自动附加的字符。因此,在这种情况下,长度_tcslen(lpSrcStr)+ 1。
lpCharType
[out]指向一组16位值。它接受一个16位中的每个源字符串字符值。如果cchSrc不是负数,lpCharType应该是与cchSrc元素的Word类型的数组。如果cchSrc为负数,lpCharType应该是与(_tcslen(lpSrcStr Word类型的数组)+ 1)元素。当函数返回时,此数组包含一个对应于每个字在源字符串的字符。
返回值
返回一个非零值如果成功,如果不成功或为零。
为了获得更多错误信息,调用GetLastError。 GetLastError函数可以返回以下错误代码之一:
ERROR_INVALID_FLAGS
ERROR_INVALID_PARAMETER
备注
安全警告:使用GetStringTypeEx功能不当,可能会损害您的应用程序的安全。为了避免缓冲区溢出,设置lpCharType缓冲区的大小正确。欲了解更多的安全信息,请参阅安全注意事项:Windows用户界面。
函数中存在的GetStringTypeEx规避内的GetStringTypeA和GetStringTypeW参数的差异所造成的限制。该参数的差异无法自动调用*通过的#define的UNICODE开关使用适当的A或W号GetStringType版本的应用程序。 GetStringTypeEx另一方面,适当行为方面的开关。因此,这是建议的功能。
注意:当此功能ANSI版本的Unicode的唯一的LCID使用时,调用可以成功,因为该系统使用系统代码页。然而,在字符系统代码页未定义出现在一个字符串问号(?)。要确定哪些LCID的是Unicode只,见语言标识符常量和字符串。
区域设置参数仅用于执行字符串转换为Unicode。它没有与CTYPEs做函数返回。该CTYPEs是完全取决于Unicode代码点,不要在不同区域的基础。例如,希腊字母是任何区域设置值C1_ALPHA。
在lpSrcStr和lpCharType指针必须不一样。如果它们是相同的,函数失败并GetLastError返回ERROR_INVALID_PARAMETER。
字符类型位被分为几个层次。在一个级别的信息,可以检索一个调用这个函数。每个级别的限制为16比特的信息,以便其他映射例程,这些限制为16个字符表示的每比特,也可以返回字符类型的信息。
字符此功能支持的类型包括以下内容。
Ctype 1
这些类型的支持ANSI C和POSIX(LC_CTYPE按)的字符输入功能。这些数值的组合是返回数组中指出当dwInfoType参数设置为CT_CTYPE1的lpCharType参数。
NameValueMeaning
C1_UPPER 0x0001Uppercase
C1_LOWER0x0002Lowercase
C1_DIGIT0x0004Decimal数字
C1_SPACE0x0008Space字符
C1_PUNCT0x0010Punctuation
C1_CNTRL0x0020Control字符
C1_BLANK0x0040Blank字符
C1_XDIGIT0x0080Hexadecimal数字
C1_ALPHA0x0100Any语言字符:字母,音节文字,或表意
C1_DEFINED0x0200A定义的字符,而不是其他C1_ 1 *类型。
下面的字符类型不是固定或基本类型可计算,并不需要通过此功能的支持。
TypeDescription
AlphanumericAlphabetical字符和数字(C1_ALPHA和C1_DIGIT)。
PrintableGraphic字符和空格(所有C1_ *类型除C1_CNTRL)。
Ctype 2
这些类型的支持Unicode文本适当的布局。方向的属性分配,使双向布局算法的Unicode的标准化生产准确的结果。这些类型是互相排斥的。如需有关这些属性的使用情况,Unicode标准:全球字符编码,卷1和2,艾迪生韦斯利出版公司:1991,1992,书号0201567881。
NameValueMeaning
强壮的
C2_LEFTTORIGHT0x0001Left的权利
C2_RIGHTTOLEFT0x0002Right到左
虚弱的
C2_EUROPENUMBER0x0003European数目,欧洲数字
C2_EUROPESEPARATOR0x0004European数字分隔
C2_EUROPETERMINATOR0x0005European数字终止
C2_ARABICNUMBER0x0006Arabic号码
C2_COMMONSEPARATOR0x0007Common数字分隔
中性
C2_BLOCKSEPARATOR0x0008Block分离器
C2_SEGMENTSEPARATOR0x0009Segment分离器
C2_WHITESPACE0x000AWhite空间
C2_OTHERNEUTRAL0x000BOther中立
不适用
C2_NOTAPPLICABLE0x0000No隐方向性(例如,控制代码)
Ctype 3
这些类型的目的是用于宣传的POSIX一般文字处理所需类型的扩展名占位符或标准C库函数。这些数值的组合时返回dwInfoType设置为CT_CTYPE3。
NameValueMeaning
C3_NONSPACING0x0001Nonspacing标志。
C3_DIACRITIC0x0002Diacritic nonspacing标志。
C3_VOWELMARK0x0004Vowel nonspacing标志。
C3_SYMBOL0x0008Symbol。
C3_KATAKANA0x0010Katakana字符。
C3_HIRAGANA0x0020Hiragana字符。
C3_HALFWIDTH0x0040Half宽(窄)字符。
C3_FULLWIDTH0x0080Full宽(宽)字符。
C3_IDEOGRAPH0x0100Ideographic字符。
C3_KASHIDA0x0200Arabic卡须达字符。
C3_LEXICAL0x0400Punctuation这算不算是单词的一部分(卡须达,连字符,女性/男性序指标,等号,等等)。
C3_ALPHA0x8000All语言字符(字母,音节文字和表意)。
C3_HIGHSURROGATE0x0800Windows Vista和更高版本:高代理编码单元。
C3_LOWSURROGATE0x1000Windows Vista和更高版本:低代理编码单元。
不适用
C3_NOTAPPLICABLE0x0000Not适用。
在Windows 95/98/Me:GetStringTypeExW是支持的Unicode(MSLU)微软层。要使用此,您必须将某些文件到您的应用,概述了对Unicode的Microsoft层在Windows 95/98/Me系统。
该GetStringTypeEx功能ANSI版本的源字符串转换为Unicode并调用相应的Unicode功能。这意味着,在lpCharType缓冲区中的关键词不符合原来的ANSI字符串,而是它的Unicode等效。由于从ANSI到Unicode转换可能会导致在字符串长度变化(例如,对ANSI字符可以映射到一个单一的Unicode字符),在lpCharType缓冲区通信与词之间的字符原ANSI字符串不是一个对一个在所有情况下(如多字节字符串)。为此,该GetStringTypeEx功能ANSI版本字符的字符串,Unicode版本的建议,而不是多用处有限。
功能信息
最低DLL版本 kernel32.dll
在Winnls.h HeaderDeclared,头文件:winuser.h
import libraryKernel32.lib
最低操作系统Windows 95,Windows NT 3.5
UnicodeImplemented为ANSI和Unicode版本。
参见
Strings 概述 ,GetLocaleInfo,GetStringTypeA,GetStringTypeW
==英文原文==GetStringTypeEx Function
Retrieves character-type information for the characters in the specified source string. For each character in the string, the function sets one or more bits in the corresponding 16-bit element of the output array. Each bit identifies a given character type, such as whether the character is a letter, a digit, or neither.
Unlike its close relatives GetStringTypeA and GetStringTypeW , GetStringTypeEx exhibits appropriate A or W behavior through the use of the #define UNICODE switch. It is the recommended function.
Syntax
BOOL GetStringTypeEx( LCID Locale,
DWORD dwInfoType,
LPCTSTR lpSrcStr,
int cchSrc,
LPWORD lpCharType
);
Parameters
Locale
[in] Specifies the locale identifier. This value uniquely defines the ANSI code page to use to translate the string pointed to by lpSrcStr from ANSI to Unicode. The function then analyzes each Unicode character for character type information.
This parameter can be a locale identifier created by the MAKELCID macro, or one of the following predefined values.
LOCALE_SYSTEM_DEFAULT
Default system locale
LOCALE_USER_DEFAULT
Default user locale
dwInfoType
[in] Specifies the type of character information the user wants to retrieve. The various types are divided into different levels (see the following Remarks section for a list of the information included in each type). This parameter can specify one of the following character type values.
CT_CTYPE1
Retrieve character type information.
CT_CTYPE2
Retrieve bidirectional layout information.
CT_CTYPE3
Retrieve text processing information.
lpSrcStr
[in] Pointer to the string for which character types are requested. If cchSrc is any negative integer, the string is not assumed to be null-terminated.
cchSrc
[in] Specifies the size, in TCHARs, of the string pointed to by the lpSrcStr parameter. This refers to bytes for ANSI versions of the function or WCHARs for Unicode versions. If this count includes a terminating NULL character, the function returns character type information for the terminating NULL character. If cchSrc is any negative integer, the string is assumed to be null-terminated and the length is calculated automatically with an additional character for a terminating NULL character. Thus, in this case, the length is _tcslen(lpSrcStr) + 1.
lpCharType
[out] Pointer to an array of 16-bit values. It receives one 16-bit value for each character in the source string. If cchSrc is not a negative number, lpCharType should be an array of type WORD with cchSrc elements. If cchSrc is a negative number, lpCharType should be an array of type WORD with (_tcslen(lpSrcStr) + 1) elements. When the function returns, this array contains one word corresponding to each character in the source string.
Return Value
Returns a nonzero value if successful or zero if unsuccessful.
To get extended error information, call GetLastError . GetLastError can return one of the following error codes:
ERROR_INVALID_FLAGS
ERROR_INVALID_PARAMETER
Remarks
Security Alert Using the GetStringTypeEx function incorrectly can compromise the security of your application. To avoid a buffer overflow, set the size of the lpCharType buffer correctly. For more security information, see Security Considerations: Windows User Interface .
The GetStringTypeEx function exists to circumvent a limitation caused by the difference in parameters of GetStringTypeA and GetStringTypeW. That parameter difference prevents an application from automatically invoking the proper A or W version of GetStringType* through the use of the #define UNICODE switch. GetStringTypeEx, on the other hand, behaves properly with regard to that switch. Thus, it is the recommended function.
Note When the ANSI version of this function is used with a Unicode-only LCID, the call can succeed because the system uses the system code page. However, characters that are undefined in the system code page appear in the string as a question mark (?). To determine which LCIDs are Unicode-only, see Language Identifier Constants and Strings .
The Locale parameter is only used to perform string conversion to Unicode. It has nothing to do with the CTYPEs the function returns. The CTYPEs are solely determined by Unicode code points, and do not vary on a locale basis. For example, Greek letters are C1_ALPHA for any Locale value.
The lpSrcStr and lpCharType pointers must not be the same. If they are the same, the function fails and GetLastError returns ERROR_INVALID_PARAMETER .
The character-type bits are divided into several levels. The information for one level can be retrieved by a single call to this function. Each level is limited to 16 bits of information so that the other mapping routines, which are limited to 16 bits of representation per character, can also return character-type information.
The character types supported by this function include the following.
Ctype 1
These types support ANSI C and POSIX (LC_CTYPE) character-typing functions. A combination of these values is returned in the array pointed to by the lpCharType parameter when the dwInfoType parameter is set to CT_CTYPE1.
NameValueMeaning
C1_UPPER 0x0001Uppercase
C1_LOWER0x0002Lowercase
C1_DIGIT0x0004Decimal digits
C1_SPACE0x0008Space characters
C1_PUNCT0x0010Punctuation
C1_CNTRL0x0020Control characters
C1_BLANK0x0040Blank characters
C1_XDIGIT0x0080Hexadecimal digits
C1_ALPHA0x0100Any linguistic character: alphabetical, syllabary, or ideographic
C1_DEFINED0x0200A defined character, but not one of the other C1_* types.
The following character types are either constant or computable from basic types and do not need to be supported by this function.
TypeDescription
AlphanumericAlphabetical characters and digits (C1_ALPHA and C1_DIGIT).
PrintableGraphic characters and blanks (all C1_* types except C1_CNTRL).
Ctype 2
These types support proper layout of Unicode text. The direction attributes are assigned so that the bidirectional layout algorithm standardized by Unicode produces accurate results. These types are mutually exclusive. For more information about the use of these attributes, see The Unicode Standard: Worldwide Character Encoding, Volumes 1 and 2, Addison Wesley Publishing Company: 1991, 1992, ISBN 0201567881.
NameValueMeaning
Strong
C2_LEFTTORIGHT0x0001Left to right
C2_RIGHTTOLEFT0x0002Right to left
Weak
C2_EUROPENUMBER0x0003European number, European digit
C2_EUROPESEPARATOR0x0004European numeric separator
C2_EUROPETERMINATOR0x0005European numeric terminator
C2_ARABICNUMBER0x0006Arabic number
C2_COMMONSEPARATOR0x0007Common numeric separator
Neutral
C2_BLOCKSEPARATOR0x0008Block separator
C2_SEGMENTSEPARATOR0x0009Segment separator
C2_WHITESPACE0x000AWhite space
C2_OTHERNEUTRAL0x000BOther neutrals
Not applicable
C2_NOTAPPLICABLE0x0000No implicit directionality (for example, control codes)
Ctype 3
These types are intended to be placeholders for extensions to the POSIX types required for general text processing or for the standard C library functions. A combination of these values is returned when dwInfoType is set to CT_CTYPE3.
NameValueMeaning
C3_NONSPACING0x0001Nonspacing mark.
C3_DIACRITIC0x0002Diacritic nonspacing mark.
C3_VOWELMARK0x0004Vowel nonspacing mark.
C3_SYMBOL0x0008Symbol.
C3_KATAKANA0x0010Katakana character.
C3_HIRAGANA0x0020Hiragana character.
C3_HALFWIDTH0x0040Half-width (narrow) character.
C3_FULLWIDTH0x0080Full-width (wide) character.
C3_IDEOGRAPH0x0100Ideographic character.
C3_KASHIDA0x0200Arabic Kashida character.
C3_LEXICAL0x0400Punctuation which is counted as part of the word (Kashida, hyphen, feminine/masculine ordinal indicators, equal sign, and so forth).
C3_ALPHA0x8000All linguistic characters (alphabetical, syllabary, and ideographic).
C3_HIGHSURROGATE0x0800Windows Vista and later: High surrogate code unit.
C3_LOWSURROGATE0x1000Windows Vista and later: Low surrogate code unit.
Not applicable
C3_NOTAPPLICABLE0x0000Not applicable.
Windows 95/98/Me: GetStringTypeExW is supported by the Microsoft Layer for Unicode (MSLU). To use this, you must add certain files to your application, as outlined in Microsoft Layer for Unicode on Windows 95/98/Me Systems .
The ANSI version of the GetStringTypeEx function converts the source string to Unicode and calls the corresponding Unicode function. This means that the WORDs in the lpCharType buffer correspond not to the original ANSI string but rather to its Unicode equivalent. Since the conversion from ANSI to Unicode may result in a change in string length (for example, a pair of ANSI characters can map to a single Unicode character), the correspondence between the WORDs in the lpCharType buffer and the characters in the original ANSI string is not one-to-one in all cases (e.g. multibyte strings). For this reason, the ANSI version of the GetStringTypeEx function is of limited utility for multi-character strings; the Unicode version is recommended instead.
Function Information
Minimum DLL Versionkernel32.dll
HeaderDeclared in Winnls.h, include Windows.h
Import libraryKernel32.lib
Minimum operating systemsWindows 95, Windows NT 3.5
UnicodeImplemented as ANSI and Unicode versions.
See Also
Strings Overview , GetLocaleInfo , GetStringTypeA , GetStringTypeW
==原始网址==http://msdn.microsoft.com/en-us/library/ms647480(VS.85).aspx\n
随便看

 

windows api函数参考手册包含2258条windows api函数文档,详细介绍nodejs、java、rust调用windows api的方法技巧,是学习windows api编程的入门中文文档。

 

Copyright © 2004-2023 Winrtm.com All Rights Reserved
京ICP备2021023879号-40 更新时间:2024/10/6 13:23:28