hi guys...

im using the AVICap code to open up a view of a webcam - then setting the parent "window" of the image to on my form - so it appears my application owns the image etc...

Microsoft WDM Image Capture (Win32) < the "Driver" being used to capture the image...

Starting video like this....
vBCode Code:
  1. Dim lpszName As String * 100
  2.     Dim lpszVer As String * 100
  3.     Dim Caps As CAPDRIVERCAPS
  4.  
  5.     '//Create Capture Window
  6.     capGetDriverDescriptionA 0, lpszName, 100, lpszVer, 100  '// Retrieves driver info
  7.    
  8.     lwndC = capCreateCaptureWindowA(lpszName, WS_CHILD Or WS_VISIBLE, 0, 0, 160, 120, lgOwner, 0)
  9.  
  10.     '// Connect the capture window to the driver
  11.     capDriverConnect lwndC, 0
  12.    
  13.     '// Get the capabilities of the capture driver
  14.     capDriverGetCaps lwndC, VarPtr(Caps), Len(Caps)
  15.    
  16.     '// Set the video stream callback function
  17.     capSetCallbackOnVideoStream lwndC, AddressOf MyVideoStreamCallback
  18.     capSetCallbackOnFrame lwndC, AddressOf MyFrameCallback
  19.    
  20.     '// Set the preview rate in milliseconds
  21.     capPreviewRate lwndC, 66
  22.    
  23.     '// Start previewing the image from the camera
  24.     capPreview lwndC, True
  25.        
  26.     '// Resize the capture window to show the whole image
  27.     ResizeCaptureWindow lwndC
  28.    
  29.     ' say we are viewing the video
  30.     bViewVideo = True


and disabling the video like this:

vbcode Code:
  1. '// Disable all callbacks
  2.     capSetCallbackOnStatus lwndC, vbNull
  3.     capSetCallbackOnYield lwndC, vbNull
  4.     capSetCallbackOnFrame lwndC, vbNull
  5.     capSetCallbackOnVideoStream lwndC, vbNull
  6.     capSetCallbackOnWaveStream lwndC, vbNull
  7.     capSetCallbackOnCapControl lwndC, vbNull
  8.     capSetCallbackOnError lwndC, vbNull
  9.    
  10.     DoEvents
  11.    
  12.     bViewVideo = False


all working great... EXCEPT:

am i correct in thinking i also need to DESTROY the window that was created using this code...
vbcode Code:
  1. lwndC = capCreateCaptureWindowA(lpszName, WS_CHILD Or WS_VISIBLE, 0, 0, 160, 120, lgOwner, 0)

just got wondering this, since the last visible image from the camera remains on my form, even though the window should of closed? (not a problem, since i hide this control anyway, but would be nice to keep the resources free)


and secondly.. i have two cameras that i can select... - i dont suppose there is a dialogless way to select either camera is there

i have searched the forums and have come to the conclusing the dialog is required, but would be nice just for confirmation of this. Cheers.