0

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.

3
Contributors
2
Replies
4
Views
10 Years
Discussion Span
Last Post by azzdog_dev
0

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

-1

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

Edited by azzdog_dev: n/a

Votes + Comments
better reply to more recent questions, this question is in VB 6 forum not .net.
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.