首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

打开摄像头的代码如何不能在Win7系统里正常使用了

2013-01-06 
打开摄像头的代码怎么不能在Win7系统里正常使用了?以下是打开摄像头代码,能在XP和2003系统里能正常打开摄

打开摄像头的代码怎么不能在Win7系统里正常使用了?
以下是打开摄像头代码,能在XP和2003系统里能正常打开摄像头,但在win7里死活没用,有人能帮忙看下吗?


const WM_CAP_START = WM_USER;
const WM_CAP_STOP = WM_CAP_START + 68;
const WM_CAP_DRIVER_CONNECT = WM_CAP_START + 10;
const WM_CAP_DRIVER_DISCONNECT = WM_CAP_START + 11;
const WM_CAP_SAVEDIB = WM_CAP_START + 25;
const WM_CAP_GRAB_FRAME = WM_CAP_START + 60;
const WM_CAP_SEQUENCE = WM_CAP_START + 62;
const WM_CAP_FILE_SET_CAPTURE_FILEA = WM_CAP_START + 20;
const WM_CAP_SEQUENCE_NOFILE =WM_CAP_START+  63 ;
const WM_CAP_SET_OVERLAY =WM_CAP_START+  51 ;
const WM_CAP_SET_PREVIEW =WM_CAP_START+  50 ;
const WM_CAP_SET_CALLBACK_VIDEOSTREAM = WM_CAP_START +6;
const WM_CAP_SET_CALLBACK_ERROR=WM_CAP_START +2;
const WM_CAP_SET_CALLBACK_STATUSA= WM_CAP_START +3;
const WM_CAP_SET_CALLBACK_FRAME= WM_CAP_START +5;
const WM_CAP_SET_SCALE=WM_CAP_START+  53 ;
const WM_CAP_SET_PREVIEWRATE=WM_CAP_START+  52 ;

var
  s:tpoint;
begin
s:=Pnl_View.ClientToScreen(point(0 ,0));

s:=ClientToScreen(point(Pnl_View.left,Pnl_View.Top));

hWndC := capCreateCaptureWindowA('My Own Capture Window',
WS_CHILD or WS_VISIBLE ,
Pnl_View.Left+3,Pnl_View.top+66,320,240,self.Handle,0);

if hWndC <> 0 then
SendMessage(hWndC, WM_CAP_SET_CALLBACK_VIDEOSTREAM, 0, 0);
SendMessage(hWndC, WM_CAP_SET_CALLBACK_ERROR, 0, 0);
SendMessage(hWndC, WM_CAP_SET_CALLBACK_STATUSA, 0, 0);
SendMessage(hWndC, WM_CAP_DRIVER_CONNECT, 0, 0);
SendMessage(hWndC, WM_CAP_SET_SCALE, 1, 0);
SendMessage(hWndC, WM_CAP_SET_PREVIEWRATE, 66, 0);
SendMessage(hWndC, WM_CAP_SET_OVERLAY, 1, 0);
SendMessage(hWndC, WM_CAP_SET_PREVIEW, 1, 0);
OpenVideo.Enabled :=false;
CloseVideo.Enabled:=true;
[解决办法]
 没人知道吗?
[解决办法]
这种方式打开摄像头对摄像头的兼容性有要求,在XP试过很多,有的好用有的不好用,换过摄像头可能就好了。
用DSPack控件,它是用Direct方式来做的,对摄像头的兼容性比较好。基本上手机、MP4、摄像头都可以用。

热点排行