I would suggest looking at IP camera's. Its probably far simpler to write a network request for a image than deal with the windows API's.
If you used a network camera from Axis they actually provide a full SDK for free. The SDK provides full documentation for direct http control and also a activex control that does the work for you.
You can get a basic unit like the 206
http://www.axis.com/produc
here a newegg link with price of $175,
http://www.newegg.com/Prod
So not free but its the SDK and hardware for the cost of a decent camera.
Axis is one of the more 'open' companies when it comes to letting you work with the camera for custom applications.
These camera's can also work with a standard FTP server to dump images down. So you could set the camera to just continually overwite a give jpg file. Then just copy the current file to your DB or whatever when somebody clocks in or out. Pretty foolproof to do plus anybody could check in to 'live view' at any time.
Main Topics
Browse All Topics





by: mjacobs2929Posted on 2007-07-14 at 05:29:35ID: 19486647
Solved it. Using the GDTWAIN ocx from http://www.gdpicture.com/p roducts/gd twain-ocx- twain-acti vex- contro l.php
n") 0")
2) &&Color
yimage.jpg '
not cheap ($75 for a single user licence) so I'm still prepared to award half the points if anyone can find a freeware version that can do the same thing, but at least this one works.
There are, however, a few errors in the VFP sample which they produced but after some trial and error I got the following code working in a form button.
(you have to download and install the ocx first of course)
IF TYPE('oTwain')<>'O'
oTwain = CREATEOBJECT("gdtwain.twai
oTwain.SetLicenseNumber ("033299342865906696337204
*this is a temporary licence for the trial version which expires in 30 days
ENDIF
thisform.image1.Picture=''
*clear existing image
IF FILE('myimage.jpg')
ERASE 'myimage.jpg'
*I erase the temporary image to ensure that I'm not picking up an old one. In the final app the image
*will be renamed and stored in the database
endif
with oTwain as gdtwain.twain
&&Open the source
IF .TwainOpenDefaultSource()
&&Set the source parameters
.TwainSetHideUI(.f.)
*their own version sets it to .t. but when I tried it their way, it refused to capture an image
.TwainSetCurrentPixelType(
&&Acquire & Save
KEYBOARD '{ENTER}'
*this was my kludge to get around the failure to capture the image without showing the UI.
*it automatically presses the "capture" button when the UI appears
nImageID = .TwainAcquireToImageID()
*had to add the brackets at the end to get this line to work
IF nImageID<>0
*added this condition because the original code doesn't warn the user in the event of failure to capture
*an image
.SaveAsJpeg('myimage.jpg')
thisform.image1.Picture='m
ELSE
MESSAGEBOX("Sorry, failed to capture image")
endif
&&Close the source
.TwainCloseSource()
*had to add the brackets at the end to get this line to work
ELSE
MESSAGEBOX("Can't open default source")
ENDIF
ENDWITH
Its not perfect. In particular, about once every 15 captures I get an error from the camera "indicating problem with capture", so, as well as half the points for a freeware version, I'll happily award half the points for a more stable version (providing it is <= $75!)