I am to present my project recently.This is very important you see I can't proceed with my project because I am not able to capture a video in my VB form from a video device attached to a PC using USB. How can I do that please help me.

Recommended Answers

All 2 Replies

Your project requires first a com control component to sniff the USB port, where you have connected your video device. Try to use the Microsoft Comm Control component. If you know that it is very easy. Another way is to use thw Window API

which has the following code to open.

Dim MyPortID as integer
Dim MyComStatus as long
Dir MyComError as string
Dim MyData as string


MyPortId=1 ' or 2 or 3 etc representing com1,com2 etc.

MyComStatus=CommOpen(MyPortID, "COM" & CStr(mytPortID), _
"baud=9600 parity=N data=8 stop=1")
If MyComStatus <> 0 then
'call Error handler
MyComStatus = commGetError(MyComError)
MsgBox "COM ERROR : " & MyComError
end sub
endif

'SET MODEM CONTROL LINES

MyComStatus = CommSetLine(MyPortID, LINE_RTS, True)
MyComStatus = CommSetLine(MytPortID, LINE_DTR, True)

'Read max 64 bytes from the port

MyComStatus = CommRead(MyPortID, MyData, 64)
If MyStatus > 0 Then
' Process data.
ElseIf MyStatus < 0 Then
' Handle error.
End If

' RESET MODEM CONTROL LINES.

MyComStatus = CommSetLine(MyPortID, LINE_RTS, False)
MyComStatus = CommSetLine(MyPortID, LINE_DTR, False)

' Close communications.
Call CommClose(MyPortID)


Please Do not ask this type of help from the forum. As you require the project very badly, I am sending this code to begin it.

Happy Programming.


AV Manoharan

the easiest way to do this is (i'm using visual basic 2008 express edition)

project>add reference
click browse
browse to the folder where touchlesslib.dll is and add it (can't remember if you need webcamlib.dll, so add it too)

then declare camcapture publicly (that is, not inside a sub)

to do this, type dim camcapture as new touchlesslib.touchlessmgr

then on the form_load event, type camcapture.currentcamera = camcapture.cameras.first 'you may modify this to choose a different camera

finally, on timer1_tick event, type dim snapshot = camcapture.currentcamera.getcurrentimage

picturebox1.image = snapshot


obviously, you have to set the timer to enabled, and the interval to 1 to prevent slow refresh rate.

if you don't have, or can't find the dynamic link libraries (.dll file) mentioned above, download them from:

http://sites.google.com/site/freecustomprograms/custom-software-downloads


EDITED: this is to display a live feed from a webcam in a picturebox. i don't know how to record videos, but i can save pictures

commented: better reply to more recent questions, this question is in VB 6 forum not .net. -3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.