VB.NET 摄像头编程求助大神们帮帮忙下面是我之前在VB6里测试过vb.net连接摄像头的代码vb.net连接摄像头:在窗体里放一个按钮叫Command1和一个PictureBox叫Picture1 。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 Long Private Const WS_CHILD = H40000000 Private Const WS_VISIBLE = H10000000 Private Const WM_USER = H400 Private Const WM_CAP_START = H400 Private Const WM_CAP_EDIT_COPY = (WM_CAP_START30) Private Const WM_CAP_DRIVER_CONNECT = (WM_CAP_START10) Private Const WM_CAP_SET_PREVIEWRATE = (WM_CAP_START52) Private Const WM_CAP_SET_OVERLAY = (WM_CAP_START51) Private Const WM_CAP_SET_PREVIEW = (WM_CAP_START50) Private Const WM_CAP_DRIVER_DISCONNECT = (WM_CAP_START11) Private Declare Function SendMessage Lib "user32" _ Alias "SendMessageA" ( _ ByVal hWnd As Long, _ ByVal wMsg As Long, _ ByVal wParam As Long, _ lParam As Any) As Long Private Declare Function SendMessageAsLong Lib "user32" Alias "SendMessageA" _ (ByVal hWnd As Long, _ ByVal wMsg As Long, _ ByVal wParam As Long, _ ByVal lParam As Long) As Long Private Preview_Handle As Long Private iDevice As Long Private hHwnd As LongPrivate Sub Command1_Click() Dim bRet As Boolean Dim szTest As String szTest = App.Path"\TEST.bmp"Chr$(0) bRet = capEditCopy(hHwnd) If bRet Then DoEvents If Clipboard.GetFormat(vbCFBitmap) Then Picture1.Picture = Clipboard.GetData(vbCFBitmap) Picture1.Picture = Clipboard.GetData(vbCFBitmap) SavePicture Picture1.Image, szTest DoEvents Clipboard.Clear End If End If End Sub Private Sub Form_Load() '建立捕获窗口 Preview_Handle = capCreateCaptureWindow("Video", WS_CHILDWS_VISIBLE, 0, 0, 320, 240, Me.hWnd, 1) '建立捕获窗口到捕获设备vb.net连接摄像头的连接 SendMessage Preview_Handle, WM_CAP_DRIVER_CONNECT, 0, 0 '设置捕获vb.net连接摄像头的帧频率为30毫秒一帧 SendMessage Preview_Handle, WM_CAP_SET_PREVIEWRATE, 30, 0 '用预览模式在捕获窗口开始预览图像 SendMessage Preview_Handle, WM_CAP_SET_PREVIEW, 1, 0 End Sub Private Sub Form_Unload(Cancel As Integer) '断开到捕获设备的连接 SendMessage Preview_Handle, WM_CAP_DRIVER_DISCONNECT, 0, 0 End Sub Private Function capEditCopy(ByVal hCapWnd As Long) As Boolean capEditCopy = SendMessageAsLong(hCapWnd, WM_CAP_EDIT_COPY, 0, 0)End Function
VB.NET怎样把USB摄像头在显示器上输出的实时画面(像素信息),引入到数据库.用directshow获取帧缓存,转换为标准图像格式(比如jpg,png这些),存储到数据库vb.net连接摄像头的image字段里就行vb.net连接摄像头了.
VB.NET怎么调用摄像头啊?求实例,最好配注释啊Private Const WS_CHILD = H40000000
Private Const WS_VISIBLE = H10000000
Private Const WM_CAP_START = H400
Private Const WM_CAP_DRIVER_CONNECT = WM_CAP_START10
Private Const WM_CAP_SET_SCALE = WM_CAP_START53
Private Const WM_CAP_SET_PREVIEWRATE = WM_CAP_START52
Private Const WM_CAP_SET_PREVIEW = WM_CAP_START50
Private Declare Function capCreateCaptureWindowA Lib "avicap32.dll" ( _
ByVal lpszWindowName As String, _
ByVal dwStyle As Long, _
ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Integer, _
ByVal hWndParent As Long, ByVal nID As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Long) As Long
Private Sub Form_Load()
'建立采集窗口(不显示窗口vb.net连接摄像头,处理后显示到PIC控件)
uwndc = capCreateCaptureWindowA("", WS_VISIBLE Or WS_CHILD, 0, 0, 320, 240, Me.hWnd, 0)
'连接
SendMessage uwndc, WM_CAP_DRIVER_CONNECT, 0, 0
'Scale开
SendMessage uwndc, WM_CAP_SET_SCALE, True, 0
'显示刷新MS
SendMessage uwndc, WM_CAP_SET_PREVIEWRATE, 40, 0
'用予览方式显示(特殊需要vb.net连接摄像头,不显示予缆)
SendMessage uwndc, WM_CAP_SET_PREVIEW, True, 0
End Sub
上述代码就可以实现 但是要注意相应vb.net连接摄像头的控件是否存在 不存在的 你自己画出来
VB中如何启动摄像头?以前在网上看到的源码 。你可以修改它,使它达到你的要求,相信这对你来说不算什么难事!加油吧^_^
windows8.1下VB.net使用摄像头这个方法没问题 。
win8.1vb.net连接摄像头 , vb.net连接摄像头我用网上vb.net连接摄像头的方法vb.net连接摄像头,有时也有黑屏现象vb.net连接摄像头,但多试几次就好了 。有时还会弹出要选择摄像头 , 选择确认、取消、应用都是黑屏 。
VB.NET中怎么调用摄像头给你个工程自己看...
运行后可以看到自己...
点按钮保存到c:\1.bmp
【vb.net连接摄像头 vb摄像头控件】vb.net连接摄像头的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于vb摄像头控件、vb.net连接摄像头的信息别忘了在本站进行查找喔 。
推荐阅读
- 电商小程序如何做转化,小程序电商赚钱吗
- 华为鸿蒙添加桌面小工具,华为鸿蒙怎么添加桌面小工具
- 用键盘输入Java代码,java如何从键盘输入一个字母
- php数据库配置 php配置数据库连接
- asp.net和node.js,aspnet和nodejs
- cssdiv依附在div,css中div
- 武汉快易游戏开发,武汉快游科技有限公司的游戏
- mysql官方手册怎么样 mysql8中文手册
- mysql在命令行改变密码,MySQL打开命令行终端