capGetVideoFormat(m_hCapture,&bmpInfo,sizeof(BITMAPINFO));
TRACE("get width=%d/n",bmpInfo.bmiHeader.biWidth);
TRACE("get biHeight=%d/n",bmpInfo.bmiHeader.biHeight);
TRACE("get biBitCount=%d/n",bmpInfo.bmiHeader.biBitCount);
TRACE("get biSize=%d/n",bmpInfo.bmiHeader.biSize);
TRACE("get biSizeImage=%d/n",bmpInfo.bmiHeader.biSizeImage);
//设置
bmpInfo.bmiHeader.biWidth=g_iWidth;
bmpInfo.bmiHeader.biHeight=g_iHeight;
//bmpInfo.bmiHeader.biBitCount=g_iBits;
//bmpInfo.bmiHeader.biSizeImage=g_iWidth*g_iHeight*g_iBits;
ghVideo=m_hCapture;
//写入
if(!capSetVideoFormat(m_hCapture,&bmpInfo,sizeof(BITMAPINFO)))
{
MessageBox("capSetVideoFormat False!");
}
需要注意以下两点:
1. 要看你得摄像头支不支持你所设的分辨率。
2. bmpInfo的参数要设对,最好只改宽和高!