BOOL CLiftCtrlModbusConfigDlg::CheckValid(const CString &str) { ASSERT(str.GetLength() > 0); if ((str[0] == '-' && str[1] > '0' && str[1] <= '9')|| (str[0] > '0' && str[0] <= '9' && str.GetLength() >= 1) || (str[0] == '0' && str.GetLength() == 1)) { for (int i = 1; i < str.GetLength(); i++) { if(!isdigit(str[i])) { return FALSE; } } return TRUE; } return FALSE; }