GetDlgItemInt(IDC_SEND_TIME)取不到值
void CEdit_Time_Send::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: 在此添加消息处理程序代码和/或调用默认值
if (((nChar >= 0x30)&&(nChar <= 0x39))||(nChar == 0x08))
{
int time = GetDlgItemInt(IDC_SEND_TIME);
if (GetDlgItemInt(IDC_SEND_TIME) < 9999)
{
CEdit::OnChar(nChar, nRepCnt, nFlags);
}
}
}
void CSerial_PortsDlg::OnBnClickedSendStart()
{
CString str;
GetDlgItemText(IDC_SEND_START,str);
if(!strcmp(str,"开始"))
{
int time = GetDlgItemInt(IDC_SEND_TIME);
if (time)
{
SetTimer(1,time,NULL);// 开始
SetDlgItemText(IDC_SEND_START,"停止");
}
else
{
KillTimer(1);// 停止
SetDlgItemText(IDC_SEND_START,"开始");
}
}
else
{
KillTimer(1);// 停止
SetDlgItemText(IDC_SEND_START,"开始");
}
}