用VB怎么制作摄像头拍照并保存到本地的程序?

用VB怎么制作摄像头拍照并保存到本地的程序?下面的代码是我从网上找来的,拍不到照片,点击保存按钮提示出错:PrivateDeclareFunctioncapCreateC... 用VB怎么制作摄像头拍照并保存到本地的程序?下面的代码是我从网上找来的,拍不到照片,点击保存按钮提示出错:Private Declare Function capCreateCaptureWindow Lib "avicap32.dll" _Alias "capCreateCaptureWindowA" ( _ByVal lpszWindowName As String, _ByVal dwStyle As Long, _ByVal x As Long, _ByVal y As Long, _ByVal nWidth As Long, _ByVal nHeight As Long, _ByVal hWndParent As Long, _ByVal nID As Long) As LongPrivate Const WS_CHILD = &H40000000Private Const WS_VISIBLE = &H10000000Private Const WM_USER = &H400Private Const WM_CAP_START = &H400Private Const WM_CAP_EDIT_COPY = (WM_CAP_START + 30)Private Const WM_CAP_DRIVER_CONNECT = (WM_CAP_START + 10)Private Const WM_CAP_SET_PREVIEWRATE = (WM_CAP_START + 52)Private Const WM_CAP_SET_OVERLAY = (WM_CAP_START + 51)Private Const WM_CAP_SET_PREVIEW = (WM_CAP_START + 50)Private Const WM_CAP_DRIVER_DISCONNECT = (WM_CAP_START + 11)Private Preview_Handle As LongPrivate Declare Function SendMessage Lib "user32" _Alias "SendMessageA" ( _ByVal hwnd As Long, _ByVal wMsg As Long, _ByVal wParam As Long, _lParam As Any) As LongPrivate Function CapturePicture(nCaptureHandle As Long) As StdPictureClipboard.ClearSendMessage nCaptureHandle, WM_CAP_EDIT_COPY, 0, 0Set CapturePicture = Clipboard.GetDataEnd FunctionPrivate Sub Command1_Click()SavePicture Picture1.Picture, "c:\a.bmp"End SubPrivate Sub Command2_Click()Picture1.Picture = CapturePicture(Preview_Handle)End SubPrivate Sub Form_Load()Preview_Handle = capCreateCaptureWindow("Video", WS_CHILD + WS_VISIBLE, 2, 2, 220, 156, Me.hwnd, 1)SendMessage Preview_Handle, WM_CAP_DRIVER_CONNECT, 0, 0SendMessage Preview_Handle, WM_CAP_SET_PREVIEWRATE, 1, 0SendMessage Preview_Handle, WM_CAP_SET_PREVIEW, 1, 0End SubPrivate Sub Form_Unload(Cancel As Integer)SendMessage Preview_Handle, WM_CAP_DRIVER_DISCONNECT, 0, 0End Sub 展开
 我来答
手机用户64344
2011-10-24 · TA获得超过223个赞
知道答主
回答量:168
采纳率:0%
帮助的人:98万
展开全部
capCreateCaptureWindow("Video", WS_CHILD WS_VISIBLE, 2, 2, 220, 156, Me.hwnd, 1)

设备名称对么?
详细的查下API吧
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
美狐美颜sdk
2024-08-06 广告
美颜SDK推出多个版本的原因有以下几点:1. 满足不同平台的需求:美颜SDK的不同版本可以满足不同平台的运营需求。例如,对于直播平台,需要更多的美颜功能来吸引观众,而视频聊天平台则需要的是精简版的美颜功能。通过提供不同版本的美颜SDK,可以... 点击进入详情页
本回答由美狐美颜sdk提供
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式