Sign in to follow this  
Followers 0
VelvetElvis

Webcam code problem

5 posts in this topic

I'm trying to get this webcam code working. Here's the forum reference:

http://www.autoitscript.com/forum/index.php?showtopic=68866&hl=Webcam++UDf

I'm using the webcam.udf by "rysiora" from that topic, and this test code from the same page, by "Limiter".

#include <GUIConstants.au3>
#include <Webcam.au3>

$gui = GUICreate("Webcam UDF Test",640,480)
_WebcamInit()
_Webcam($gui,640,480,0,0)
GUISetState(@SW_SHOW)
Sleep(2000)
ConsoleWrite("Taking snapshot ..." & @CRLF)
_WebcamSnapShot()
ConsoleWrite("Snapshot taken !" & @CRLF)

While 1
 $msg = GUIGetMsg()
    If $msg = $GUI_EVENT_CLOSE Then
  _WebcamStop()
  Exit
 EndIf
 Sleep(1)
WEnd

However, I'm getting the following errors:

D:\AutoIt scripts\#3rdPartyIncludes\Webcam.au3(122,91) : WARNING: $WS_CHILD: possibly used before declaration.

$cap = DllCall($avi, "int", "capCreateCaptureWindow", "str", "cap", "int", BitOR($WS_CHILD,

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

D:\AutoIt scripts\#3rdPartyIncludes\Webcam.au3(122,103) : WARNING: $WS_VISIBLE: possibly used before declaration.

$cap = DllCall($avi, "int", "capCreateCaptureWindow", "str", "cap", "int", BitOR($WS_CHILD,$WS_VISIBLE)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

D:\AutoIt scripts\#3rdPartyIncludes\Webcam.au3(122,91) : ERROR: $WS_CHILD: undeclared global variable.

$cap = DllCall($avi, "int", "capCreateCaptureWindow", "str", "cap", "int", BitOR($WS_CHILD,

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

D:\AutoIt scripts\#3rdPartyIncludes\WebCamTest.au3 - 1 error(s), 2 warning(s)

This is undoubtedly something very basic (and probably embarrassing) that I'm missing. Can someone please enlighten me?

Share this post


Link to post
Share on other sites



I see someone else had the same problem in that thread but no response posted. $WS_CHILD, etc, are all defined in WindowsConstants.au3.

Share this post


Link to post
Share on other sites

Maybe #include <WindowsConstants.au3>?

:blink:

Bingo! Thank you Theri and PsaltyDS.

Share this post


Link to post
Share on other sites

I got a problem, stating

"C:\Program Files (x86)\AutoIt3\Include\Webcam.au3" (153) : ==> Subscript used on non-accessible variable.:
DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_GRAB_FRAME_NOSTOP, "int", 0, "int", 0)
DllCall($user, "int", "SendMessage", "hWnd", $cap^ ERROR

 

my code is as follows

______________________

#include<Webcam.au3>
_WebcamSnapShot()

 

_______________________

 

when i used #requireadmin

problem got solved, but no snapshot!!!

-------------------------------------

i also used webcamInit()

but of no use..

Please suggest some ways.

I just want take a snap. 

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0