Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET
I am using Visual Basic 2010. Trying to reliably capture webcam images. It works some times - but about 50% of the time it pops up and asks for the video source. Even after this popup it only works sporatically.
 
Platform Windows 7 32bit, Vusial Basic 2010
 
Here is a sample of my code - taken from the examples posted on the web.
 
Private Sub OpenForm()
       Try
 
           Dim iHeight As Integer = Privew.Height
           Dim iWidth As Integer = Privew.Width
 
           '
           ' Open Preview window in picturebox
           '
           hHwnd = capCreateCaptureWindowA(iDevice, WS_VISIBLE Or WS_CHILD, 0, 0, 640, _
               480, Privew.Handle.ToInt32, 0)
 
           '
           ' Connect to device
           '
           If SendMessage(hHwnd, WM_CAP_DRIVER_CONNECT, iDevice, 0) Then
               '
               'Set the preview scale
               '
               SendMessage(hHwnd, WM_CAP_SET_SCALE, True, 0)
 
               '
               'Set the preview rate in milliseconds
               '
               SendMessage(hHwnd, WM_CAP_SET_PREVIEWRATE, 66, 0)
 
               '
               'Start previewing the image from the camera
               '
               SendMessage(hHwnd, WM_CAP_SET_PREVIEW, True, 0)
 
               '
               ' Resize window to fit in picturebox
               '
               SetWindowPos(hHwnd, HWND_BOTTOM, 0, 0, Privew.Width, Privew.Height, _
                       SWP_NOMOVE Or SWP_NOZORDER)
           End If
       Catch ex As Exception
 
       End Try
 

It only works occasionally - many times asking me for the 'Video Source' before it may or maynot show the image.
 
if any one know help me
Thanx in Advance
Posted 17-Dec-12 20:10pm

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

what dll are you using for capture the webcam image ?
  Permalink  
Comments
MinhajAli at 18-Dec-12 6:38am
   
I am using Avicap32.dll

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 9,225
1 OriginalGriff 5,395
2 Peter Leow 4,100
3 Maciej Los 3,540
4 Abhinav S 3,333


Advertise | Privacy | Mobile
Web04 | 2.8.140415.2 | Last Updated 18 Dec 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Use
Layout: fixed | fluid