函数capCreateCaptureWindow的完整声明如下:
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 作者:
Nothing 时间: 2010-5-5 10:40
我用VB写的读取摄像头序号的程序,只能列出序号为“0”的摄像头来,不知道是为什么。
以下是摘自楼上的回复。
char szDeviceName[80];
char szDeviceVersion[80];
for (wIndex = 0; wIndex < 10; wIndex++)
{
if (capGetDriverDescription (wIndex, szDeviceName,
sizeof (szDeviceName), szDeviceVersion,
sizeof (szDeviceVersion))
{
// 加入名字到一个已经安装的设备列表中
// 让用户选择一个使用。
}
}
以下代码是我用VB写的,语法跟上面不一样,但运行起来就只能列出序号为“0”的摄像头,不知道是什么原因
'---list all the various video sources---
Function ListVideoSources()
Dim DriverName As String * 80
Dim DriverVersion As String * 80
Label1.Caption = ""
For i = 0 To 9
If capGetDriverDescriptionA(i, DriverName, 80, DriverVersion, 80) Then
Label1.Caption = Label1.Caption & "第" & i & "个摄像头" & Trim(DriverName) & vbCrLf
End If
Next
End Function 作者:
Nothing 时间: 2010-12-7 21:35