Index
2012-05-09 07:06 – James Harvey : video streaming in vfp application
2012-05-09 07:14 – Michael Madigan : Re: video streaming in vfp application
2012-05-09 07:22 – Dave Crozier : RE: video streaming in vfp application
2012-05-09 07:34 – Ajit Abraham : Re: video streaming in vfp application
2012-05-09 09:22 – James Harvey : RE: video streaming in vfp application
2012-05-09 10:15 – Allen : Re: video streaming in vfp application
2012-05-09 10:34 – Dave Crozier : RE: video streaming in vfp application
2012-05-09 10:36 – Dave Crozier : RE: video streaming in vfp application
Back to top
video streaming in vfp application

Author: James Harvey

Posted: 2012-05-09 07:06:04   Link

Has anyone tried to provide a live video stream inside a visual foxpro

application?

We'd like to provide a live video stream of each horse as it is being

auctioned, and wanted to have the stream appear inside a "container" on a

vfp form which would include additional textboxes on the form containing

pertinent data for the horse being auctioned.

Research indicates there might be an active x control to put on the form to

handle the video. I found a couple references to ActiveX controls, but was

hoping someone has already had some experience with this subject.

James E Harvey

Corresponding Officer/M.I.S.

Hanover Shoe Farms, Inc.

www.hanoverpa.com

office: 717-637-8931

cell: 717-887-2565

fax: 717-637-6766

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/031801cd2ddc$1c4177c0$54c46740$@hanoverpa.com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2012 James Harvey
Back to top
Re: video streaming in vfp application

Author: Michael Madigan

Posted: 2012-05-09 07:14:20   Link

I haven't done it, but I think it should be pretty easy to do.  

http://www.viscomsoft.com/products/movieplayer/index.html 

This is the first company I Googled that provides ActiveX object for VFP, there must be others.  

________________________________

From: James Harvey <jharvey@hanoverpa.com>

To: 'ProFox Email List' <profox@leafe.com>

Sent: Wednesday, May 9, 2012 8:06 AM

Subject: video streaming in vfp application

Has anyone tried to provide a live video stream inside a visual foxpro

application?

We'd like to provide a live video stream of each horse as it is being

auctioned, and wanted to have the stream appear inside a "container" on a

vfp form which would include additional textboxes on the form containing

pertinent data for the horse being auctioned.

Research indicates there might be an active x control to put on the form to

handle the video.  I found a couple references to ActiveX controls, but was

hoping someone has already had some experience with this subject.

James E Harvey

Corresponding Officer/M.I.S.

Hanover Shoe Farms, Inc.

www.hanoverpa.com

office: 717-637-8931

cell: 717-887-2565

fax: 717-637-6766

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/031801cd2ddc$1c4177c0$54c46740$@hanoverpa.com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

--- StripMime Report -- processed MIME parts ---

multipart/alternative

text/plain (text body -- kept)

text/html

---

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/1336565660.20987.YahooMailNeo@web125606.mail.ne1.yahoo.com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2012 Michael Madigan
Back to top
RE: video streaming in vfp application

Author: Dave Crozier

Posted: 2012-05-09 07:22:08   Link

I've used the viscomsoft activex before and it is good but you can do it for nothing courtesy of Craig Boyd.

http://www.tek-tips.com/faqs.cfm?fid=3891

or you can use the coding below to display data from a webcam:

*******************

* START OF CODE

*******************

Local oForm

oForm = Createobject("Tform")

oForm.Show(1)

* end of main

Define Class Tform As Form

#Define WM_CAP_START 0x0400

#Define WM_CAP_DRIVER_CONNECT (WM_CAP_START+10)

#Define WM_CAP_DRIVER_DISCONNECT (WM_CAP_START+11)

#Define WM_CAP_DRIVER_GET_CAPS (WM_CAP_START+14)

#Define WM_CAP_SET_PREVIEW (WM_CAP_START+50)

#Define WM_CAP_SET_OVERLAY (WM_CAP_START+51)

#Define WM_CAP_SET_PREVIEWRATE (WM_CAP_START+52)

#Define WM_CAP_GET_STATUS (WM_CAP_START+54)

#Define WM_CAP_GRAB_FRAME (WM_CAP_START+60)

Width=340

Height=310

AutoCenter=.T.

Caption="Using Video Capture"

MinButton=.F.

MaxButton=.F.

hWindow=0

hCapture=0

capWidth=0

capHeight=0

capOverlay=0

Add Object cmdGetFrame As CommandButton With Default=.T.,;

Left=15, Top=264, Height=27, Width=90, Caption="Get Frame",;

Enabled=.F.

Add Object cmdPreview As CommandButton With Default=.T.,;

Left=106, Top=264, Height=27, Width=100, Caption="Preview Video",;

Enabled=.F.

Add Object cmdClose As CommandButton With Cancel=.T.,;

Left=207, Top=264, Height=27, Width=70, Caption="Close"

Procedure Activate

If This.hWindow = 0

Declare Integer GetFocus In user32

This.hWindow = GetFocus()

This.CreateCaptureWindow

This.DriverConnect

This.cmdPreview.Click

Endif

Procedure Destroy

This.ReleaseCaptureWindow

endproc

Procedure cmdClose.Click

Thisform.Release

endproc

Procedure cmdGetFrame.Click

Thisform.GetFrame

endproc

Procedure cmdPreview.Click

Thisform.StartPreview

endproc

Procedure GetFrame

#Define WM_CAP_FILE_SAVEDIB (WM_CAP_START + 25)

Local lcFile

LOCAL lcFile

lcFile = "" && File name to create

lcFile = "c:\temp\sample.bmp"

try

MKDIR JUSTPATH( lcFile )

catch

*

endtry

This.msg(WM_CAP_GRAB_FRAME, 0,0)

This.msg(WM_CAP_FILE_SAVEDIB, 0, lcFile,1)

*

endproc

Procedure CreateCaptureWindow

#Define WS_CHILD 0x40000000

#Define WS_VISIBLE 0x10000000

Declare Integer capCreateCaptureWindow In avicap32;

STRING lpszWindowName, Long dwStyle,;

INTEGER x, Integer Y,;

INTEGER nWidth, Integer nHeight,;

INTEGER hParent, Integer nID

This.hCapture = capCreateCaptureWindow("",;

WS_CHILD+WS_VISIBLE,;

10,8,320,240, This.hWindow, 1)

*

endproc

Procedure DriverConnect

This.msg(WM_CAP_DRIVER_CONNECT, 0,0)

If This.IsCaptureConnected()

This.GetCaptureDimensions

Store .T. To This.cmdGetFrame.Enabled,;

THIS.cmdPreview.Enabled

This.Caption = This.Caption + ": connected, " +;

LTRIM(Str(This.capWidth)) + "x" +;

LTRIM(Str(This.capHeight))

Else

This.Caption = This.Caption + ": failed to connect"

Endif

*

endproc

Procedure DriverDisconnect

This.msg(WM_CAP_DRIVER_DISCONNECT, 0,0)

endproc

Procedure ReleaseCaptureWindow

If This.hCapture <> 0

This.DriverDisconnect

Declare Integer DestroyWindow In user32 Integer HWnd

= DestroyWindow(This.hCapture)

This.hCapture = 0

*

Endif

*

endproc

Procedure msg(msg, wParam, Lparam, nMode)

If This.hCapture = 0

Return

Endif

If Vartype(nMode) <> "N" Or nMode=0

Declare Integer SendMessage In user32;

INTEGER HWnd, Integer Msg,;

INTEGER wParam, Integer Lparam

= SendMessage(This.hCapture, msg, wParam, Lparam)

Else

Declare Integer SendMessage In user32;

INTEGER HWnd, Integer Msg,;

INTEGER wParam, String @Lparam

= SendMessage(This.hCapture, msg, wParam, @Lparam)

*

Endif

*

endproc

Function IsCaptureConnected

* analyzing fCaptureInitialized member of the CAPDRIVERCAPS structure

#Define CAPDRIVERCAPS_SIZE 44

Local cBuffer, nResult

cBuffer = Repli(Chr(0),CAPDRIVERCAPS_SIZE)

This.msg(WM_CAP_DRIVER_GET_CAPS, Len(cBuffer), @cBuffer, 1)

This.capOverlay = buf2dword(Substr(cBuffer,5,4))

nResult = Asc(Substr(cBuffer, 21,1))

Return (nResult<>0)

*

endfunc

Procedure GetCaptureDimensions

* reading uiImageWidth and uiImageHeight members

* of the CAPSTATUS structure

#Define CAPSTATUS_SIZE 76

Local cBuffer

cBuffer = Repli(Chr(0), CAPSTATUS_SIZE)

This.msg(WM_CAP_GET_STATUS, Len(cBuffer), @cBuffer, 1)

This.capWidth = buf2dword(Substr(cBuffer,1,4))

This.capHeight = buf2dword(Substr(cBuffer,5,4))

*

endproc

Procedure StartPreview

This.msg(WM_CAP_SET_PREVIEWRATE, 30,0)

This.msg(WM_CAP_SET_PREVIEW, 1,0)

If This.capOverlay <> 0

This.msg(WM_CAP_SET_OVERLAY, 1,0)

Endif

*

endproc

Procedure StopPreview

This.msg(WM_CAP_SET_PREVIEW, 0,0)

Enddefine

Function buf2dword(lcBuffer)

Return Asc(Substr(lcBuffer, 1,1)) + ;

BitLShift(Asc(Substr(lcBuffer, 2,1)), 8) +;

BitLShift(Asc(Substr(lcBuffer, 3,1)), 16) +;

BitLShift(Asc(Substr(lcBuffer, 4,1)), 24)

endfunc

*

enddefine

*

******************

* END OF CODE

*****************

-----Original Message-----

From: profox-bounces@leafe.com [mailto:profox-bounces@leafe.com] On Behalf Of James Harvey

Sent: 09 May 2012 13:06

To: 'ProFox Email List'

Subject: video streaming in vfp application

Has anyone tried to provide a live video stream inside a visual foxpro application?

We'd like to provide a live video stream of each horse as it is being auctioned, and wanted to have the stream appear inside a "container" on a vfp form which would include additional textboxes on the form containing pertinent data for the horse being auctioned.

Research indicates there might be an active x control to put on the form to handle the video. I found a couple references to ActiveX controls, but was hoping someone has already had some experience with this subject.

James E Harvey

Corresponding Officer/M.I.S.

Hanover Shoe Farms, Inc.

www.hanoverpa.com

office: 717-637-8931

cell: 717-887-2565

fax: 717-637-6766

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/BD031ECABF2B60499200AAB3DBB4A999F11E26F3@EX-A-FPL.FPL.LOCAL

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2012 Dave Crozier
Back to top
Re: video streaming in vfp application

Author: Ajit Abraham

Posted: 2012-05-09 07:34:13   Link

http://fox.wikis.com/wc.dll?Wiki~VideoCaptureApi

_Ajit Abraham

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/4FAA6445.8030100@ua-group.com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2012 Ajit Abraham
Back to top
RE: video streaming in vfp application

Author: James Harvey

Posted: 2012-05-09 09:22:01   Link

Thanks, I used Craig's code, and was able to get the form to load, now I

just need to find a camera to test it out...

James E Harvey

Corresponding Officer/M.I.S.

Hanover Shoe Farms, Inc.

www.hanoverpa.com

office: 717-637-8931

cell: 717-887-2565

fax: 717-637-6766

-----Original Message-----

From: profox-bounces@leafe.com [mailto:profox-bounces@leafe.com] On Behalf

Of Dave Crozier

Sent: Wednesday, May 09, 2012 8:22 AM

To: ProFox Email List

Subject: RE: video streaming in vfp application

I've used the viscomsoft activex before and it is good but you can do it for

nothing courtesy of Craig Boyd.

http://www.tek-tips.com/faqs.cfm?fid=3891

or you can use the coding below to display data from a webcam:

*******************

* START OF CODE

*******************

Local oForm

oForm = Createobject("Tform")

oForm.Show(1)

* end of main

Define Class Tform As Form

#Define WM_CAP_START 0x0400

#Define WM_CAP_DRIVER_CONNECT (WM_CAP_START+10)

#Define WM_CAP_DRIVER_DISCONNECT (WM_CAP_START+11)

#Define WM_CAP_DRIVER_GET_CAPS (WM_CAP_START+14)

#Define WM_CAP_SET_PREVIEW (WM_CAP_START+50)

#Define WM_CAP_SET_OVERLAY (WM_CAP_START+51)

#Define WM_CAP_SET_PREVIEWRATE (WM_CAP_START+52)

#Define WM_CAP_GET_STATUS (WM_CAP_START+54)

#Define WM_CAP_GRAB_FRAME (WM_CAP_START+60)

Width=340

Height=310

AutoCenter=.T.

Caption="Using Video Capture"

MinButton=.F.

MaxButton=.F.

hWindow=0

hCapture=0

capWidth=0

capHeight=0

capOverlay=0

Add Object cmdGetFrame As CommandButton With Default=.T.,;

Left=15, Top=264, Height=27, Width=90, Caption="Get Frame",;

Enabled=.F.

Add Object cmdPreview As CommandButton With Default=.T.,;

Left=106, Top=264, Height=27, Width=100, Caption="Preview

Video",;

Enabled=.F.

Add Object cmdClose As CommandButton With Cancel=.T.,;

Left=207, Top=264, Height=27, Width=70, Caption="Close"

Procedure Activate

If This.hWindow = 0

Declare Integer GetFocus In user32

This.hWindow = GetFocus()

This.CreateCaptureWindow

This.DriverConnect

This.cmdPreview.Click

Endif

Procedure Destroy

This.ReleaseCaptureWindow

endproc

Procedure cmdClose.Click

Thisform.Release

endproc

Procedure cmdGetFrame.Click

Thisform.GetFrame

endproc

Procedure cmdPreview.Click

Thisform.StartPreview

endproc

Procedure GetFrame

#Define WM_CAP_FILE_SAVEDIB (WM_CAP_START + 25)

Local lcFile

LOCAL lcFile

lcFile = "" && File name to create

lcFile = "c:\temp\sample.bmp"

try

MKDIR JUSTPATH( lcFile )

catch

*

endtry

This.msg(WM_CAP_GRAB_FRAME, 0,0)

This.msg(WM_CAP_FILE_SAVEDIB, 0, lcFile,1)

*

endproc

Procedure CreateCaptureWindow

#Define WS_CHILD 0x40000000

#Define WS_VISIBLE 0x10000000

Declare Integer capCreateCaptureWindow In avicap32;

STRING lpszWindowName, Long dwStyle,;

INTEGER x, Integer Y,;

INTEGER nWidth, Integer nHeight,;

INTEGER hParent, Integer nID

This.hCapture = capCreateCaptureWindow("",;

WS_CHILD+WS_VISIBLE,;

10,8,320,240, This.hWindow, 1)

*

endproc

Procedure DriverConnect

This.msg(WM_CAP_DRIVER_CONNECT, 0,0)

If This.IsCaptureConnected()

This.GetCaptureDimensions

Store .T. To This.cmdGetFrame.Enabled,;

THIS.cmdPreview.Enabled

This.Caption = This.Caption + ": connected, " +;

LTRIM(Str(This.capWidth)) + "x" +;

LTRIM(Str(This.capHeight))

Else

This.Caption = This.Caption + ": failed to connect"

Endif

*

endproc

Procedure DriverDisconnect

This.msg(WM_CAP_DRIVER_DISCONNECT, 0,0)

endproc

Procedure ReleaseCaptureWindow

If This.hCapture <> 0

This.DriverDisconnect

Declare Integer DestroyWindow In user32 Integer HWnd

= DestroyWindow(This.hCapture)

This.hCapture = 0

*

Endif

*

endproc

Procedure msg(msg, wParam, Lparam, nMode)

If This.hCapture = 0

Return

Endif

If Vartype(nMode) <> "N" Or nMode=0

Declare Integer SendMessage In user32;

INTEGER HWnd, Integer Msg,;

INTEGER wParam, Integer Lparam

= SendMessage(This.hCapture, msg, wParam, Lparam)

Else

Declare Integer SendMessage In user32;

INTEGER HWnd, Integer Msg,;

INTEGER wParam, String @Lparam

= SendMessage(This.hCapture, msg, wParam, @Lparam)

*

Endif

*

endproc

Function IsCaptureConnected

* analyzing fCaptureInitialized member of the CAPDRIVERCAPS

structure

#Define CAPDRIVERCAPS_SIZE 44

Local cBuffer, nResult

cBuffer = Repli(Chr(0),CAPDRIVERCAPS_SIZE)

This.msg(WM_CAP_DRIVER_GET_CAPS, Len(cBuffer), @cBuffer, 1)

This.capOverlay = buf2dword(Substr(cBuffer,5,4))

nResult = Asc(Substr(cBuffer, 21,1))

Return (nResult<>0)

*

endfunc

Procedure GetCaptureDimensions

* reading uiImageWidth and uiImageHeight members

* of the CAPSTATUS structure

#Define CAPSTATUS_SIZE 76

Local cBuffer

cBuffer = Repli(Chr(0), CAPSTATUS_SIZE)

This.msg(WM_CAP_GET_STATUS, Len(cBuffer), @cBuffer, 1)

This.capWidth = buf2dword(Substr(cBuffer,1,4))

This.capHeight = buf2dword(Substr(cBuffer,5,4))

*

endproc

Procedure StartPreview

This.msg(WM_CAP_SET_PREVIEWRATE, 30,0)

This.msg(WM_CAP_SET_PREVIEW, 1,0)

If This.capOverlay <> 0

This.msg(WM_CAP_SET_OVERLAY, 1,0)

Endif

*

endproc

Procedure StopPreview

This.msg(WM_CAP_SET_PREVIEW, 0,0)

Enddefine

Function buf2dword(lcBuffer)

Return Asc(Substr(lcBuffer, 1,1)) + ;

BitLShift(Asc(Substr(lcBuffer, 2,1)), 8) +;

BitLShift(Asc(Substr(lcBuffer, 3,1)), 16) +;

BitLShift(Asc(Substr(lcBuffer, 4,1)), 24)

endfunc

*

enddefine

*

******************

* END OF CODE

*****************

-----Original Message-----

From: profox-bounces@leafe.com [mailto:profox-bounces@leafe.com] On Behalf

Of James Harvey

Sent: 09 May 2012 13:06

To: 'ProFox Email List'

Subject: video streaming in vfp application

Has anyone tried to provide a live video stream inside a visual foxpro

application?

We'd like to provide a live video stream of each horse as it is being

auctioned, and wanted to have the stream appear inside a "container" on a

vfp form which would include additional textboxes on the form containing

pertinent data for the horse being auctioned.

Research indicates there might be an active x control to put on the form to

handle the video. I found a couple references to ActiveX controls, but was

hoping someone has already had some experience with this subject.

James E Harvey

Corresponding Officer/M.I.S.

Hanover Shoe Farms, Inc.

www.hanoverpa.com

office: 717-637-8931

cell: 717-887-2565

fax: 717-637-6766

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/032601cd2def$1a728980$4f579c80$@hanoverpa.com

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2012 James Harvey
Back to top
Re: video streaming in vfp application

Author: Allen

Posted: 2012-05-09 10:15:48   Link

I was unable to find the file mentioned so I searched with bing only to find

the ocx mentioned as a virus.

Al

-----Original Message-----

Thanks, I used Craig's code, and was able to get the form to load, now I

just need to find a camera to test it out...

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/C304A3E15E244A32A16EA26C7D8EB5E9@gslredacer

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2012 Allen
Back to top
RE: video streaming in vfp application

Author: Dave Crozier

Posted: 2012-05-09 10:34:33   Link

James,

Download a program called Manycam, it is free and it effectively allows you to multistream a physical webcam or emulate one with pictures, videos or even your live desktop etc. You can test out the program then with pictures. The nice thing about it is that you can zoom in/out with manycam and also add effects and titling. I'll leave it up to you to find out how to find out the way of removing the "Manycam" title logo from the screen. It's easy once you find it.. lol.

Just holler if you have any problems.

http://download.manycam.com/

Dave

-----Original Message-----

From: profox-bounces@leafe.com [mailto:profox-bounces@leafe.com] On Behalf Of James Harvey

Sent: 09 May 2012 15:22

To: 'ProFox Email List'

Subject: RE: video streaming in vfp application

Thanks, I used Craig's code, and was able to get the form to load, now I just need to find a camera to test it out...

James E Harvey

Corresponding Officer/M.I.S.

Hanover Shoe Farms, Inc.

www.hanoverpa.com

office: 717-637-8931

cell: 717-887-2565

fax: 717-637-6766

-----Original Message-----

From: profox-bounces@leafe.com [mailto:profox-bounces@leafe.com] On Behalf

Of Dave Crozier

Sent: Wednesday, May 09, 2012 8:22 AM

To: ProFox Email List

Subject: RE: video streaming in vfp application

I've used the viscomsoft activex before and it is good but you can do it for

nothing courtesy of Craig Boyd.

http://www.tek-tips.com/faqs.cfm?fid=3891

or you can use the coding below to display data from a webcam:

*******************

* START OF CODE

*******************

Local oForm

oForm = Createobject("Tform")

oForm.Show(1)

* end of main

Define Class Tform As Form

#Define WM_CAP_START 0x0400

#Define WM_CAP_DRIVER_CONNECT (WM_CAP_START+10)

#Define WM_CAP_DRIVER_DISCONNECT (WM_CAP_START+11)

#Define WM_CAP_DRIVER_GET_CAPS (WM_CAP_START+14)

#Define WM_CAP_SET_PREVIEW (WM_CAP_START+50)

#Define WM_CAP_SET_OVERLAY (WM_CAP_START+51)

#Define WM_CAP_SET_PREVIEWRATE (WM_CAP_START+52)

#Define WM_CAP_GET_STATUS (WM_CAP_START+54)

#Define WM_CAP_GRAB_FRAME (WM_CAP_START+60)

Width=340

Height=310

AutoCenter=.T.

Caption="Using Video Capture"

MinButton=.F.

MaxButton=.F.

hWindow=0

hCapture=0

capWidth=0

capHeight=0

capOverlay=0

Add Object cmdGetFrame As CommandButton With Default=.T.,;

Left=15, Top=264, Height=27, Width=90, Caption="Get Frame",;

Enabled=.F.

Add Object cmdPreview As CommandButton With Default=.T.,;

Left=106, Top=264, Height=27, Width=100, Caption="Preview

Video",;

Enabled=.F.

Add Object cmdClose As CommandButton With Cancel=.T.,;

Left=207, Top=264, Height=27, Width=70, Caption="Close"

Procedure Activate

If This.hWindow = 0

Declare Integer GetFocus In user32

This.hWindow = GetFocus()

This.CreateCaptureWindow

This.DriverConnect

This.cmdPreview.Click

Endif

Procedure Destroy

This.ReleaseCaptureWindow

endproc

Procedure cmdClose.Click

Thisform.Release

endproc

Procedure cmdGetFrame.Click

Thisform.GetFrame

endproc

Procedure cmdPreview.Click

Thisform.StartPreview

endproc

Procedure GetFrame

#Define WM_CAP_FILE_SAVEDIB (WM_CAP_START + 25)

Local lcFile

LOCAL lcFile

lcFile = "" && File name to create

lcFile = "c:\temp\sample.bmp"

try

MKDIR JUSTPATH( lcFile )

catch

*

endtry

This.msg(WM_CAP_GRAB_FRAME, 0,0)

This.msg(WM_CAP_FILE_SAVEDIB, 0, lcFile,1)

*

endproc

Procedure CreateCaptureWindow

#Define WS_CHILD 0x40000000

#Define WS_VISIBLE 0x10000000

Declare Integer capCreateCaptureWindow In avicap32;

STRING lpszWindowName, Long dwStyle,;

INTEGER x, Integer Y,;

INTEGER nWidth, Integer nHeight,;

INTEGER hParent, Integer nID

This.hCapture = capCreateCaptureWindow("",;

WS_CHILD+WS_VISIBLE,;

10,8,320,240, This.hWindow, 1)

*

endproc

Procedure DriverConnect

This.msg(WM_CAP_DRIVER_CONNECT, 0,0)

If This.IsCaptureConnected()

This.GetCaptureDimensions

Store .T. To This.cmdGetFrame.Enabled,;

THIS.cmdPreview.Enabled

This.Caption = This.Caption + ": connected, " +;

LTRIM(Str(This.capWidth)) + "x" +;

LTRIM(Str(This.capHeight))

Else

This.Caption = This.Caption + ": failed to connect"

Endif

*

endproc

Procedure DriverDisconnect

This.msg(WM_CAP_DRIVER_DISCONNECT, 0,0)

endproc

Procedure ReleaseCaptureWindow

If This.hCapture <> 0

This.DriverDisconnect

Declare Integer DestroyWindow In user32 Integer HWnd

= DestroyWindow(This.hCapture)

This.hCapture = 0

*

Endif

*

endproc

Procedure msg(msg, wParam, Lparam, nMode)

If This.hCapture = 0

Return

Endif

If Vartype(nMode) <> "N" Or nMode=0

Declare Integer SendMessage In user32;

INTEGER HWnd, Integer Msg,;

INTEGER wParam, Integer Lparam

= SendMessage(This.hCapture, msg, wParam, Lparam)

Else

Declare Integer SendMessage In user32;

INTEGER HWnd, Integer Msg,;

INTEGER wParam, String @Lparam

= SendMessage(This.hCapture, msg, wParam, @Lparam)

*

Endif

*

endproc

Function IsCaptureConnected

* analyzing fCaptureInitialized member of the CAPDRIVERCAPS

structure

#Define CAPDRIVERCAPS_SIZE 44

Local cBuffer, nResult

cBuffer = Repli(Chr(0),CAPDRIVERCAPS_SIZE)

This.msg(WM_CAP_DRIVER_GET_CAPS, Len(cBuffer), @cBuffer, 1)

This.capOverlay = buf2dword(Substr(cBuffer,5,4))

nResult = Asc(Substr(cBuffer, 21,1))

Return (nResult<>0)

*

endfunc

Procedure GetCaptureDimensions

* reading uiImageWidth and uiImageHeight members

* of the CAPSTATUS structure

#Define CAPSTATUS_SIZE 76

Local cBuffer

cBuffer = Repli(Chr(0), CAPSTATUS_SIZE)

This.msg(WM_CAP_GET_STATUS, Len(cBuffer), @cBuffer, 1)

This.capWidth = buf2dword(Substr(cBuffer,1,4))

This.capHeight = buf2dword(Substr(cBuffer,5,4))

*

endproc

Procedure StartPreview

This.msg(WM_CAP_SET_PREVIEWRATE, 30,0)

This.msg(WM_CAP_SET_PREVIEW, 1,0)

If This.capOverlay <> 0

This.msg(WM_CAP_SET_OVERLAY, 1,0)

Endif

*

endproc

Procedure StopPreview

This.msg(WM_CAP_SET_PREVIEW, 0,0)

Enddefine

Function buf2dword(lcBuffer)

Return Asc(Substr(lcBuffer, 1,1)) + ;

BitLShift(Asc(Substr(lcBuffer, 2,1)), 8) +;

BitLShift(Asc(Substr(lcBuffer, 3,1)), 16) +;

BitLShift(Asc(Substr(lcBuffer, 4,1)), 24)

endfunc

*

enddefine

*

******************

* END OF CODE

*****************

-----Original Message-----

From: profox-bounces@leafe.com [mailto:profox-bounces@leafe.com] On Behalf

Of James Harvey

Sent: 09 May 2012 13:06

To: 'ProFox Email List'

Subject: video streaming in vfp application

Has anyone tried to provide a live video stream inside a visual foxpro

application?

We'd like to provide a live video stream of each horse as it is being

auctioned, and wanted to have the stream appear inside a "container" on a

vfp form which would include additional textboxes on the form containing

pertinent data for the horse being auctioned.

Research indicates there might be an active x control to put on the form to

handle the video. I found a couple references to ActiveX controls, but was

hoping someone has already had some experience with this subject.

James E Harvey

Corresponding Officer/M.I.S.

Hanover Shoe Farms, Inc.

www.hanoverpa.com

office: 717-637-8931

cell: 717-887-2565

fax: 717-637-6766

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/BD031ECABF2B60499200AAB3DBB4A999F11E29BC@EX-A-FPL.FPL.LOCAL

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2012 Dave Crozier
Back to top
RE: video streaming in vfp application

Author: Dave Crozier

Posted: 2012-05-09 10:36:22   Link

Al,

I sent you a copy of it by email.

If anyone else wants the OCX I'll post it on Ed's site.

Dave

-----Original Message-----

From: profox-bounces@leafe.com [mailto:profox-bounces@leafe.com] On Behalf Of Allen

Sent: 09 May 2012 16:16

To: profox@leafe.com

Subject: Re: video streaming in vfp application

I was unable to find the file mentioned so I searched with bing only to find the ocx mentioned as a virus.

Al

-----Original Message-----

Thanks, I used Craig's code, and was able to get the form to load, now I just need to find a camera to test it out...

[excessive quoting removed by server]

_______________________________________________

Post Messages to: ProFox@leafe.com

Subscription Maintenance: http://leafe.com/mailman/listinfo/profox

OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech

Searchable Archive: http://leafe.com/archives/search/profox

This message: http://leafe.com/archives/byMID/profox/BD031ECABF2B60499200AAB3DBB4A999F11E29E4@EX-A-FPL.FPL.LOCAL

** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

©2012 Dave Crozier