void CDahaojiDlg::OnTimer(UINT nlDEvent)
{
if(nlDEvent==2)
{
CTimeSpan time=time2-time1;
strTime1.Format("%2d小時 %2d分 %2d秒",time.GetHours(),time.GetMinutes(),time.GetSeconds());
GetDlgItem(IDC_STATIC29)->SetWindowText(strTime1);
if(strTime1=="0小時0分0秒")
{
KillTimer(2);
SetTimer(21,1000,NULL);
}
}
}
On Timer中運行到GetDlgItem(__IDC__STATIC29)->SetWindowText(strTime1);
時出現Unhandled exception in xxx.exe (MFC42.DLL): 0XC0000005: Access Violation.本人是菜鳥不太懂,請各位大俠幫忙。_
內存訪問錯誤,可能有空值