The GetDlgItemInt function translates the text of a specified control in a dialog box into an integer value.
Syntax
UINT GetDlgItemInt( HWND hDlg,
int nIDDlgItem,
BOOL *lpTranslated,
BOOL bSigned
);
Parameters
hDlg
[in] Handle to the dialog box that contains the control of interest.
nIDDlgItem
[in] Specifies the identifier of the control whose text is to be translated.
lpTranslated
[out] Pointer to a variable that receives a success or failure value (TRUE indicates success, FALSE indicates failure).
If this parameter is NULL, the function returns no information about success or failure.
bSigned
[in] Specifies whether the function should examine the text for a minus sign at the beginning and return a signed integer value if it finds one (TRUE specifies this should be done, FALSE that it should not).
Return Value
If the function succeeds, the variable pointed to by lpTranslated is set to TRUE, and the return value is the translated value of the control text.
If the function fails, the variable pointed to by lpTranslated is set to FALSE, and the return value is zero. Note that, because zero is a possible translated value, a return value of zero does not by itself indicate failure.
If lpTranslated is NULL, the function returns no information about success or failure.
Note that, if the bSigned parameter is TRUE and there is a minus sign (–) at the beginning of the text, GetDlgItemInt translates the text into a signed integer value. Otherwise, the function creates an unsigned integer value. To obtain the proper value in this case, cast the return value to an int type.
在MSDN中,可以查到.
详情回复
发表于 2009-7-21 16:42
hDlg
[in] Handle to the dialog box that contains the control of interest.
nIDDlgItem
[in] Specifies the identifier of the control whose text is to be translated.
lpTranslated
[out] Pointer to a variable that receives a success or failure value (TRUE indicates success, FALSE indicates failure).
If this parameter is NULL, the function returns no information about success or failure.
bSigned
[in] Specifies whether the function should examine the text for a minus sign at the beginning and return a signed integer value if it finds one (TRUE specifies this should be done, FALSE that it should not).
Return Value
If the function succeeds, the variable pointed to by lpTranslated is set to TRUE, and the return value is the translated value of the control text.
If the function fails, the variable pointed to by lpTranslated is set to FALSE, and the return value is zero. Note that, because zero is a possible translated value, a return value of zero does not by itself indicate failure.
If lpTranslated is NULL, the function returns no information about success or failure.
Note that, if the bSigned parameter is TRUE and there is a minus sign (–) at the beginning of the text, GetDlgItemInt translates the text into a signed integer value. Otherwise, the function creates an unsigned integer value. To obtain the proper value in this case, cast the return value to an int type.