|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
avicap32.dll issues (Is Ken Tucker Around?)I am using a web cam service that saves images every five minutes based off the example given by Ken Tucker. (hopefully I can catch him!) It works great for the most part. I need to handle a situation if the camera, or connection to the camera become interupted. I am connecting through a device called a "dazzle" which for some reason or another causes a few connection problems here and there. If the camera goes offline the image does not update, and the preview window becomes frozen with the last frame before the connection was interupted. I noticed in the CAPSTATUS structure a few properties I could test for to see if the image is "live". The problem is that "fLiveWindow" always returns 1...even on a preview window with a still image. There is another property "fCapturingNow" but it always returns 0. I could even use "dwCurrentVideoFrame" and see if the count stopped but that too always returns 0. What am I missing? How can I test if the preview window has a live or moving image? Public Structure CAPSTATUS Dim uiImageWidth As Integer Dim uiImageHeight As Integer Dim fLiveWindow As Integer Dim fOverlayWindow As Integer Dim fScale As Integer Dim ptScroll As POINTAPI Dim fUsingDefaultPalette As Integer Dim fAudioHardware As Integer Dim fCapFileExists As Integer Dim dwCurrentVideoFrame As Integer Dim dwCurrentVideoFramesDropped As Integer Dim dwCurrentWaveSamples As Integer Dim dwCurrentTimeElapsedMS As Integer Dim hPalCurrent As Integer Dim fCapturingNow As Integer Dim dwReturn As Integer Dim wNumVideoAllocated As Integer Dim wNumAudioAllocated As Integer End Structure I use the following to access the structure... Dim s As CAPSTATUS bReturn = SendMessage(hHwnd, WM_CAP_GET_STATUS, Marshal.SizeOf(s), s) Thanks a million for any assistance! Thanks, Jeremy Function capGetStatus(ByVal lwnd As Integer, ByVal s As Integer, ByVal
wSize As Short) As Boolean capGetStatus = SendMessage(lwnd, WM_CAP_GET_STATUS, wSize, s) End Function i haven't tried fLiveWindow yet. because i'm using winXp but doesn't have capture card yet :-( regards, ken tucker is working on website project regards Jeremy wrote: Show quoteHide quote >Hello > >I am using a web cam service that saves images every five minutes based >off the example given by Ken Tucker. (hopefully I can catch him!) It >works great for the most part. > >I need to handle a situation if the camera, or connection to the camera >become interupted. I am connecting through a device called a "dazzle" >which for some reason or another causes a few connection problems here >and there. > >If the camera goes offline the image does not update, and the preview >window becomes frozen with the last frame before the connection was >interupted. > >I noticed in the CAPSTATUS structure a few properties I could test for >to see if the image is "live". The problem is that "fLiveWindow" always >returns 1...even on a preview window with a still image. There is >another property "fCapturingNow" but it always returns 0. I could even >use "dwCurrentVideoFrame" and see if the count stopped but that too >always returns 0. What am I missing? How can I test if the preview >window has a live or moving image? > >Public Structure CAPSTATUS > Dim uiImageWidth As Integer > Dim uiImageHeight As Integer > Dim fLiveWindow As Integer > Dim fOverlayWindow As Integer > Dim fScale As Integer > Dim ptScroll As POINTAPI > Dim fUsingDefaultPalette As Integer > Dim fAudioHardware As Integer > Dim fCapFileExists As Integer > Dim dwCurrentVideoFrame As Integer > Dim dwCurrentVideoFramesDropped As Integer > Dim dwCurrentWaveSamples As Integer > Dim dwCurrentTimeElapsedMS As Integer > Dim hPalCurrent As Integer > Dim fCapturingNow As Integer > Dim dwReturn As Integer > Dim wNumVideoAllocated As Integer > Dim wNumAudioAllocated As Integer > End Structure > >I use the following to access the structure... > >Dim s As CAPSTATUS > >bReturn = SendMessage(hHwnd, WM_CAP_GET_STATUS, Marshal.SizeOf(s), s) > >Thanks a million for any assistance! > >Thanks, >Jeremy > > > Thanks for your reply Supra,
I read an earlier discussion between you and Henry Wu: http://groups-beta.google.com/group/microsoft.public.dotnet.languages.vb/browse_frm/thread/7c71088fb20b3293/960f363163cce7d1?q=WM_CAP_GET_STATUS&rnum=9&hl=en#960f363163cce7d1 Ken gave the following solution (which is what I am using to update CAPSTATUS): Declare Function SendMessage Lib "user32" Alias "SendMessageA" _ (ByVal hwnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, _ ByRef lParam As CAPSTATUS) As Boolean Dim bReturn As Boolean Dim wSize As Integer Dim s As CAPSTATUS bReturn = SendMessage(hHwnd, WM_CAP_GET_STATUS, Marshal.SizeOf(s), s) Debug.WriteLine(String.Format("Video Size {0} x {1}", s.uiImageWidth, s.uiImageHeight)) Of course not the Debug.WriteLine statement. Since fLiveWindow always returns true ("1") even with the camera disconnected I am either using it incorrectly, or it simply has limitations. I am guessing I am using it incorrectly because many (not all) of the other CAPSTATUS structure values return 0 no matter what the preview window state. Is there an event I can use that will fire if the connection status to the camera changes? Thanks, Jeremy |
|||||||||||||||||||||||