问题描述
求助啊。。。winform调用本地摄像头录像,可以看到图像,但是录像时失败,errorcode=0x57,求解。付代码:IntPtrhBmp=Marshal.StringToHGlobalAnsi(path);SendMessage(hWndC,WM_CAP_FILE_SET_CAPTURE_FILEA,0,hBmp.ToInt32());SendMessage(hWndC,WM_CAP_SEQUENCE,0,0);interrCode=Marshal.GetLastWin32Error();
解决方案
解决方案二:
privateconstintWM_CAP_SEQUENCE=WM_CAP_START+62;...[DllImport("avicap32.dll")]privatestaticexternIntPtrcapCreateCaptureWindowA(byte[]lpszWindowName,intdwStyle,intx,inty,intnWidth,intnHeight,IntPtrhWndParent,intnID);[DllImport("User32.dll",SetLastError=true)]privatestaticexternboolSendMessage(IntPtrhWnd,intwMsg,intwParam,intlParam);///<summary>///录像///</summary>///<paramname="path">要保存avi文件的路径</param>publicintKinescope(stringpath){IntPtrhBmp=Marshal.StringToHGlobalAnsi(path);SendMessage(hWndC,WM_CAP_FILE_SET_CAPTURE_FILEA,0,hBmp.ToInt32());//返回值:trueSendMessage(hWndC,WM_CAP_SEQUENCE,0,0);//返回值:falseinterrCode=Marshal.GetLastWin32Error();//errCode=0x57;}
解决方案三:
解决方案四:
谢谢你的回答,但是没有解决我的问题,我的问题是录像时返回错误码0x57interrCode=Marshal.GetLastWin32Error();//errCode=0x57;在其他机器上是可以录像的,在我的机器上出现了上面的错误码,我想知道这是什么原因?