Jump to content

Webcam UDF + Win7


Recommended Posts

Hi there,

Been trying for a few hours to get the Webcam UDF working with windows 7. I've been trying to run it on my laptop (with the inbuilt) where it works fine, but the minute I try to do it with my external it all goes pear shaped.

In the _Webcam() function in the UDF I tried to change the values of:

DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_DRIVER_CONNECT, "int", 0, "int", 0)

to

DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_DRIVER_CONNECT, "int", 1, "int", 0)
DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_DRIVER_CONNECT, "int", 2, "int", 0)

But all I end up getting is a blank screen.

When set to 0 (only with both plugged in. Still comes up if I disable the inter grated camera). I manage to get this GUI:

Posted Image

If I select the intergrated camera, it works fine.

I've tried to find drivers for my LifeCam VX-700, but it appears there aren't any. I have however installed the Microsoft LifeCam software and it seemed to indicated it was installing them? Other sources seem to say it doesn't need any.

The crappy thing is that I can view the webcam in MSN and use it! It just doesn't seem to want to work for my anywhere else.

I would really like to work out the issue before tomorrow as I need the program working for then.

Code:

#include <GUIConstantsEx.au3>
#include <Webcam.au3>

;Initiate the webcam
_WebcamInit()

;Folder to store images, no trailing slash
$image_dir = @ScriptDir & "\" & @YEAR & @MON & @MDAY

;Time between taking images (ms)
$timelapse = 2000

;Size of Webcam Image
$width = 320
$height = 240

;Create $image_dir
If Not FileExists ($image_dir) Then DirCreate ($image_dir)

;Create the GUI
$gui = GUICreate("Time Lapse", $width, $height)

;Create the webcam on the GUI
_Webcam($gui, $width, $height, 0, 0)

ToolTip ("Loading")
;Wait for webcam to initate
Sleep (5000)
;Show the GUI
GUISetState(@SW_SHOW)

$timer = TimerInit()

While 1
    $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
        _WebcamStop()
        Exit
    ElseIf $timer >= $timelapse Then
        _WebcamSnapShot($image_dir & "\" & @MDAY & @MON & @MDAY & @HOUR & @MIN & @SEC & ".jpg")
        $timer = TimerInit ()
    EndIf
WEnd

Cheers,

Brett

Link to comment
Share on other sites

  • 2 months later...

Brett, if you have irfanview installed, open it and see if the device is listed in the TWAIN souces. Actually it doesn't have to be irfanview, anything that lists the available TWAIN devices will do it.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...