MFC經過button控制編輯框是否顯示系統時間

在dlg.h中public函數

bool flag;post

在構造函數中spa

flag=false;orm

在button的生成函數中it

if(flag)
{
flag=false;
//m_showtime.SetWindowText(_T(""));
GetDlgItem(IDC_ShowTime)->SetWindowTextW(_T(""));   //IDC_ShowTime爲編輯框ID


}
else
{

CTime time = CTime::GetCurrentTime();
CString str;
str = time.Format(_T("%Y-%m-%d %H:%M:%S %A"));
//SetWindowTextW(str);//,THREAD_PRIORITY_IDLE);
GetDlgItem(IDC_ShowTime)->SetWindowTextW(str);


flag=true;


}
class

相關文章
相關標籤/搜索