image grab from webcam

Hi....I am quite new to VB6 and am playing about with code from a motion detection program.where this code plays a wav
file when motion is detected i would like to grab the image and store it when motion is detected.Any pointers on how i would go about this would be greatly appreciated.
Below is part of the code that i am using........thanks in advance.


Function OnMotion(M_Percent As Long)
  If M_Percent > intruder.Slider1.Value Then
    If (Count_Of_Motions_Flag = True) Then
      Count_Of_Motions = Count_Of_Motions + 1
      intruder.Text1 = Count_Of_Motions
      Count_Of_Motions_Flag = False
      sndPlaySound "alarm.wav", SND_ASYNC Or SND_NODEFAULT
    End If
  End If
  If M_Percent <= intruder.Slider2.Value Then
    Count_Of_Motions_Flag = True
  End If
End Function
SccfcAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SccfcAuthor Commented:
Hi thanks for the quick response.......this is what i have now after playing about with it but am still having problems with it.......as i said my vb is very basic but would appreciate any help/pointers.....many thanks in advance


Function capGrabFrame(ByVal hCapWnd As Long) As Boolean
   capGrabFrame = SendMessageAsLong(hCapWnd, WM_CAP_GRAB_FRAME, 0&, 0&)
End Function

--------------------------------------------------------------
Function OnMotion(M_Percent As Long)
  If M_Percent > Watchman.Slider1.Value Then
    If (Count_Of_Motions_Flag = True) Then
      Count_Of_Motions = Count_Of_Motions + 1
      Watchman.Text1 = Count_Of_Motions
      Count_Of_Motions_Flag = False
     Call capGrabFrame(hCapWnd)
 
  FileName = App.Path & "\pic.bmp"
  retval = capFileSaveDIB(hCapWnd, FileName)
  If (retval = False) Then
    MsgBox "Problem saving frame", vbInformation, App.Title
  End If
  picCapture2.Picture = LoadPicture(FileName)
 
  End If
  If M_Percent <= Watchman.Slider2.Value Then
    Count_Of_Motions_Flag = True
  End If
End Function
0
JackOfPHCommented:
p@ing
0
SccfcAuthor Commented:
thanks navstar16.......will have a look and maybe post a new question...........thanks again
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.