處理主對話框的WM_TIMER消息,判斷某一路是否有視頻信號。代碼如下:
void CCaptureDlg::OnTimer(UINT nIDEvent)
{
//判斷某一路是否有信號
eFieldFrequency frequency;
for (int i=0;i<m_DevNum;i++)
{
VCAGetVidFieldFrq(i,frequency); //獲得視頻源輸入頻率
if(frequency == FIELD_FREQ_0HZ) //無信號
{
if (m_Frame.m_pList[i].m_ShowImage == TRUE)
{
m_Frame.m_pList[i].m_ShowImage = FALSE;
m_Frame.m_pList[i].Invalidate(); //更新預(yù)覽窗口
}
}
else
{
if(m_Frame.m_pList[i].m_ShowImage == FALSE) //判斷是否顯示圖片
{
m_Frame.m_pList[i].m_ShowImage = TRUE;
m_Frame.m_pList[i].Invalidate(); //更新預(yù)覽窗口
if(m_Frame.m_pList[i].m_Stop == psPreview)
{
//更新視頻預(yù)覽窗口
VCAUpdateOverlayWnd(m_Frame.m_hWnd);
VCAUpdateVideoPreview(i,m_Frame.m_pList[i].m_hWnd);
}
}
}
}
CDialog::OnTimer(nIDEvent);
}