//double型
char str[32];
GetDlgItemText(IDC_EDIT_LEFTX, str,5);
double dLeftX = atof(str);
//int型
int nn;
GetDlgItemInt(IDC_EDIT_LEFTX, nn,5);
WCHAR str[20];
GetDlgItem(IDC_COMBO_PRESET)->GetWindowText(str, 20);
if (_tcsstr(str, _T("复位")))
{
GetPTZCommand(5, 1, ch, nLen);
wstring sOutput;
m_pArc->PTZControl(ch, nLen, &sOutput);
}
else if (_tcsstr(str, _T("隧道内")))
{
GetPTZCommand(5, 11, ch, nLen);
wstring sOutput;
m_pArc->PTZControl(ch, nLen, &sOutput);
}
博客展示了在C++中获取编辑框文本并转换数据类型的代码。包括将编辑框文本转换为double型,使用GetDlgItemText获取文本后用atof转换;还展示了转换为int型,使用GetDlgItemInt函数。
798

被折叠的 条评论
为什么被折叠?



