?
Solved

image grab from webcam

Posted on 2006-03-20
4
Medium Priority
?
322 Views
Last Modified: 2008-01-09
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
0
Comment
Question by:Sccfc
  • 2
4 Comments
 

Author Comment

by:Sccfc
ID: 16246326
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
 
LVL 15

Expert Comment

by:JackOfPH
ID: 16264630
p@ing
0
 

Author Comment

by:Sccfc
ID: 16268121
thanks navstar16.......will have a look and maybe post a new question...........thanks again
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question