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 21: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
0 Kornfeld Eliyahu Peter 169
1 George Jonsson 145
2 Zoltán Zörgő 139
3 PIEBALDconsult 130
4 OriginalGriff 120
0 OriginalGriff 6,165
1 DamithSL 4,658
2 Maciej Los 4,107
3 Kornfeld Eliyahu Peter 3,649
4 Sergey Alexandrovich Kryukov 3,382


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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100