Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to access the webcam
Message
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01530556
Message ID:
01530574
Views:
287
>>>Has anybody accessed a webcam (internal or axternal) from vfp?
>>>
>>>Peter
>>
>>I use VisioForge video capture and grab a frame from the video feed. All the other non-activex solutions I found were spotty, at best.
>I downloaded the demo but it's .net stuff
>do you have any code examples on how to use this from within VFP?

drag the activex control on a form, name it oleVideo and create dropdown list box called cboDevices on form

In form's init method call thisform.initvideodevices()
method initvideodevices
LOCAL lnCount,lnx
lnCount=thisform.oleVideo.Video_capturedevices_getcount()

** Zero Based
IF lnCount>=1
	FOR lnX=1 TO lnCount
		lcName=thisform.oleVideo.video_capturedevices_getitem(lnX-1)
		thisform.cboDevices.AddItem(lcName,lnX)
	ENDFOR
	IF EMPTY(thisform.cboDevices.value)
		thisform.cboDevices.Value=thisform.oleVideo.video_capturedevices_getitem(lnCount-1)
	ENDIF
	IF !EMPTY(thisform.cboDevices.Value)
		thisform.initvideo()
	ENDIF
ELSE
	MESSAGEBOX("No video devices found.",0+64+0,_screen.cApplicationName)
ENDIF

method initvideo
TRY
	thisform.oleVideo.setserial("your-serial")
	thisform.oleVideo.video_CaptureDevice=thisform.cboDevices.Value
	thisform.oleVideo.audio_playAudio=.F.
	thisform.oleVideo.deinterlace_use=.F.
	thisform.oleVideo.video_useeffects=.F.
	thisform.oleVideo.video_framerate=10
	thisform.oleVideo.outputformat= 9  && Format_DirectStream_DV 10  && Format_DirectStream_MPEG 
	*thisform.oleVideo.video_codec="MJPEG Compressor"
	*thisform.oleVideo.video_use_Compression=.F.

	thisform.oleVideo.network_streaming_enabled=.F.
	thisform.oleVideo.audio_captureformat_useBest=.F.		&&.T.
	thisform.oleVideo.video_captureformat_usebest=.T.		&&.T.
	thisform.oleVideo.video_renderer= 1  && VR_VMR9
	thisform.oleVideo.screen_stretch=.F.
	thisform.oleVideo.video_renderer_deinterlace_UseDefault= .T.
	thisform.oleVideo.video_resizeorcrop_Enabled=.F.

	thisform.oleVideo.start()
	
CATCH TO oErr
	MESSAGEBOX("Error: "+oErr.message,0+64+0,_screen.cApplicationName)
ENDTRY


method getpicture
LPARAMETERS lcFileNameWithPath,lnImageQuality
thisform.oleVideo.frame_Grabber_Enabled=.T.
thisform.oleVideo.frame_GetCurrent()
thisform.oleVideo.frame_SaveToJPEGFile(lcFileNameWithPath,lnImageQuality)
Brandon Harker
Sebae Data Solutions
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform