1.做一个简单的视频预览程序,但是根本没有反应。代码就是抄的,查了很多资料,在win7下就是没法。(我的是联想电脑的内置摄像头)
代码如下: bool flag=false;
flag=capDriverConnect(m_hWndVideo,0);
while(!flag)
{
flag=capDriverConnect(m_hWndVideo,0);//网上查的要反复连接,我写了但是没有区别
}
if (flag)
{
::SetParent(m_hWndVideo,*this);
::SetWindowLong(m_hWndVideo,GWL_STYLE,WS_CHILD); CRect wndRC;
m_Panel.GetClientRect(wndRC);
m_Panel.MapWindowPoints(this,wndRC);
wndRC.DeflateRect(1,1,1,1);
::SetWindowPos(m_hWndVideo,NULL,wndRC.left,wndRC.top,wndRC.Width(),wndRC.Height(),SWP_NOZORDER);
::ShowWindow(m_hWndVideo,SW_SHOW);
capDlgVideoSource(m_hWndVideo);
capPreviewRate(m_hWndVideo,30);
capPreview(m_hWndVideo,TRUE);
}
2.另外一个写了这一句capSetCallbackOnVideoStream(m_hWndVideo, EncodeCallback)
在对应的回调函数CServerDlg* pDlg = (CServerDlg*)AfxGetMainWnd()//CServerDlg就是对话框
写了int nState = pDlg->m_Video.GetCheck();这一句问题就大了,我debug了一下发现就是这一句的问题,即使pDlg->m_Video.GetCheck()换成了dlg中的普通变量仍然运行不过。我觉得是AfxGetMainWnd()的问题,但是没找到其他方法。应该怎么在这个回调函数中调用主对话框的东西啦???
代码如下: bool flag=false;
flag=capDriverConnect(m_hWndVideo,0);
while(!flag)
{
flag=capDriverConnect(m_hWndVideo,0);//网上查的要反复连接,我写了但是没有区别
}
if (flag)
{
::SetParent(m_hWndVideo,*this);
::SetWindowLong(m_hWndVideo,GWL_STYLE,WS_CHILD); CRect wndRC;
m_Panel.GetClientRect(wndRC);
m_Panel.MapWindowPoints(this,wndRC);
wndRC.DeflateRect(1,1,1,1);
::SetWindowPos(m_hWndVideo,NULL,wndRC.left,wndRC.top,wndRC.Width(),wndRC.Height(),SWP_NOZORDER);
::ShowWindow(m_hWndVideo,SW_SHOW);
capDlgVideoSource(m_hWndVideo);
capPreviewRate(m_hWndVideo,30);
capPreview(m_hWndVideo,TRUE);
}
2.另外一个写了这一句capSetCallbackOnVideoStream(m_hWndVideo, EncodeCallback)
在对应的回调函数CServerDlg* pDlg = (CServerDlg*)AfxGetMainWnd()//CServerDlg就是对话框
写了int nState = pDlg->m_Video.GetCheck();这一句问题就大了,我debug了一下发现就是这一句的问题,即使pDlg->m_Video.GetCheck()换成了dlg中的普通变量仍然运行不过。我觉得是AfxGetMainWnd()的问题,但是没找到其他方法。应该怎么在这个回调函数中调用主对话框的东西啦???
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货