网站首页  词典首页

请输入您要查询的函数:

 

术语 getstringtypea
释义 GetStringTypeA
语法:
BOOL GetStringTypeA( LCID Locale,
DWORD dwInfoType,
LPCSTR lpSrcStr,
int cchSrc,
LPWORD lpCharType
);
GetStringTypeA功能
检索字符类型中指定的源字符串中的字符的信息。对于每个字符在字符串中,该函数设置在相应的一个或多个16位位输出数组元素。每个位确定了给定字符,例如是否字符是字母,数字或两种类型。
参数
区域设置
[in]指定的区域设置标识符。此值唯一定义ANSI代码页用来翻译所指向的字符串从ANSI lpSrcStr为Unicode。该函数然后分析每个字符类型信息Unicode字符。
此参数可以是一个区域设置标识符的MAKELCID宏,或下列之一创建预定义值。
请注意该区域设置参数不存在GetStringTypeW功能。由于该参数的差异,应用程序不能自动调用*通过的#define的UNICODE开关使用适当的A或W号GetStringType版本。应用程序可以绕过使用GetStringTypeEx,这是建议的功能此限制。
LOCALE_SYSTEM_DEFAULT
默认的系统区域
LOCALE_USER_DEFAULT
默认用户区域
dwInfoType
[in]指定字符类型信息的用户想收回。各类型分为不同级别划分(参见资料列表下面的备注部分包括在每个类型)。此参数可以指定下列字符类型标志之一。
CT_CTYPE1
检索字符类型的信息。
CT_CTYPE2
检索双向布局信息。
CT_CTYPE3
检索文本处理的信息。
lpSrcStr
[in]指向那些性格类型的请求的字符串。如果cchSrc任何负整数,该字符串不是假定为空终止。这必须是一个ANSI字符串。请注意,这可能是一个双字节字符集(DBCS)字符串如果语言环境是适当的DBCS的。
cchSrc
[in]指定的大小,以字符的字符串指向的lpSrcStr参数。如果此数包括终止NULL字符,则函数返回字符终止空字符类型的信息。如果cchSrc任何负整数,字符串被假定为空终止的长度计算是一个额外的空字符自动终止。因此,在这种情况下,长度_tcslen(lpSrcStr)+ 1。
lpCharType
[out]指向一组16位值。该数组的长度必须足够大,接收每个源字符串中的字符一个16位值。如果cchSrc不是负数,lpCharType应该是与cchSrc元素的Word类型的数组。 If cchSrc is a negative number, lpCharType should be an array of type WORD with (_tcslen(lpSrcStr) + 1) elements.当函数返回时,此数组包含一个对应于每个字在源字符串的字符。
返回值
返回一个非零值如果成功或为零,如果函数失败。
为了获得更多错误信息,调用GetLastError。 GetLastError函数可以返回以下错误代码之一:
ERROR_INVALID_FLAGS
ERROR_INVALID_PARAMETER
备注
安全警告:使用GetStringTypeA功能不当,可能会损害您的应用程序的安全。为了避免缓冲区溢出,设置lpCharType缓冲区的大小正确。欲了解更多的安全信息,请参阅安全注意事项:Windows用户界面。
注意:当此功能ANSI版本的Unicode的唯一的LCID使用时,调用可以成功,因为该系统使用系统代码页。然而,在字符系统代码页未定义出现在一个字符串问号(?)。要确定哪些LCID的是Unicode只,见语言标识符常量和字符串。
在lpSrcStr和lpCharType指针必须不一样。如果它们是相同的,函数失败并GetLastError返回ERROR_INVALID_PARAMETER。
区域设置参数仅用于执行字符串转换为Unicode。它没有与CTYPEs做函数返回。该CTYPEs是完全取决于Unicode代码点,不要在不同区域的基础。例如,希腊字母是任何区域设置值C1_ALPHA。
字符类型位被分为几个层次。在一个级别的信息,可以检索一个调用这个函数。每个级别的限制为16比特的信息,以便其他映射例程,这些限制为16个字符表示的每比特,也可以返回字符类型的信息。
字符此功能支持的类型包括以下内容。
Ctype 1
这些类型的支持ANSI C和POSIX(LC_CTYPE按)的字符输入功能。按位的这些值或返回数组中指出当dwInfoType参数设置为CT_CTYPE1的lpCharType参数。对于DBCS的语言环境,在Ctype 1属性同时适用于狭窄的字符和宽字符。日本平假名和片假名字符,汉字和汉字字符都有C1_ALPHA属性。
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文本适当的布局。对于DBCS的语言环境,Ctype 2适用于狭窄,宽字符。方向的属性分配,使双向布局算法的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。对于DBCS的语言环境,在Ctype 3属性都适用于狭窄的字符和宽字符。日本平假名和片假名字符,汉字和汉字字符都有C3_ALPHA属性。
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适用。
C3_HIGHSURROGATE和C3_LOWSURROGATE只列出完整性,而且永远不应该由这个函数返回的,他们对于Unicode有关只。
这个函数源字符串转换为Unicode并调用相应的GetStringTypeW功能。这意味着,在lpCharType缓冲区中的关键词不符合原来的ANSI字符串,而是它的Unicode等效。由于从ANSI到Unicode转换可能会导致在字符串长度变化(例如,对ANSI字符可以映射到一个单一的Unicode字符),在lpCharType缓冲区通信与词之间的字符原ANSI字符串不是一个对一个在所有情况下(如多字节字符串)。为此,该GetStringTypeA功能是有限的公用事业多字符的字符串; GetStringTypeW和Unicode版本的GetStringTypeEx推荐代替。
功能信息
最低DLL版本 kernel32.dll
在Winnls.h HeaderDeclared,头文件:winuser.h
import libraryKernel32.lib
最低操作系统Windows 95,Windows NT 3.5
UnicodeImplemented的ANSI版本。
参见
Strings 概述 ,GetLocaleInfo,GetStringTypeEx,GetStringTypeW
==英文原文==GetStringTypeA 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.
Syntax
BOOL GetStringTypeA( LCID Locale,
DWORD dwInfoType,
LPCSTR 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.
Note that the Locale parameter does not exist in the GetStringTypeW function. Because of that parameter difference, an application cannot automatically invoke the proper A or W version of GetStringType* through the use of the #define UNICODE switch. An application can circumvent this limitation by using GetStringTypeEx , which is the recommended function.
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 flags.
CT_CTYPE1
Retrieve character type information.
CT_CTYPE2
Retrieve bi-directional 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. 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.
cchSrc
[in] Specifies the size, in characters, of the string pointed to by the lpSrcStr parameter. 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 the null-termination. Thus, in this case, the length is _tcslen(lpSrcStr) + 1.
lpCharType
[out] Pointer 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. 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 the function fails.
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 GetStringTypeA 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 .
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 lpSrcStr and lpCharType pointers must not be the same. If they are the same, the function fails and GetLastError returns ERROR_INVALID_PARAMETER .
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 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 bitwise-OR of these values is returned in the array pointed to by the lpCharType parameter when the dwInfoType parameter is set to CT_CTYPE1. For DBCS locales, the Ctype 1 attributes apply to both narrow characters and wide characters. The Japanese Hiragana and Katakana characters, and the kanji ideograph characters all have the C1_ALPHA attribute.
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. For DBCS locales, Ctype 2 applies to both narrow and wide characters. The direction attributes are assigned so that the bi-directional 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 bitwise-OR of these values is returned when dwInfoType is set to CT_CTYPE3. For DBCS locales, the Ctype 3 attributes apply to both narrow characters and wide characters. The Japanese Hiragana and Katakana characters, and the kanji ideograph characters all have the C3_ALPHA attribute.
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.
C3_HIGHSURROGATE and C3_LOWSURROGATE are listed only for completeness, and should never be returned by this function; they are relevant only for Unicode.
This function converts the source string to Unicode and calls the corresponding GetStringTypeW 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 GetStringTypeA function is of limited utility for multi-character strings; GetStringTypeW and the Unicode version of GetStringTypeEx are 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 version.
See Also
Strings Overview , GetLocaleInfo , GetStringTypeEx , GetStringTypeW
==原始网址==http://msdn.microsoft.com/en-us/library/ms647479(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:24:28