Sign in to follow this  
Followers 0
Celtic88

Capture an image from a webcam !

9 posts in this topic

hallo everybody :)

Is there another way :(

SNAPWEBCAM(@ScriptDir & "\WBshot.bmp")
Func SNAPWEBCAM($snapfile)
Local Const $WS_CHILD = 0x40000000
Local Const $WM_CAP_START = 0x400
Local $WM_CAP_FILE_SAVEDIBA = $WM_CAP_START + 25
Local $WM_CAP_GRAB_FRAME_NOSTOP = $WM_CAP_START + 61
Local $WM_CAP_DRIVER_DISCONNECT = $WM_CAP_START + 11
Local $WM_CAP_DRIVER_CONNECT = $WM_CAP_START + 10
Local $WM_CAP_SET_SCALE = $WM_CAP_START + 53
Local $WM_CAP_SET_OVERLAY = $WM_CAP_START + 51
Local $WM_CAP_SET_PREVIEWRATE = $WM_CAP_START + 52
Local $WM_CAP_SET_PREVIEW = $WM_CAP_START + 50
Local $WM_CAP_UNICODE_START = $WM_CAP_START + 100
Local $avi = DllOpen("avicap32.dll")
Local $user = DllOpen("user32.dll")
Local $cap = DllCall($avi, "int", "capCreateCaptureWindow", "str", "cap", "int", $WS_CHILD, "int", 15, "int", 15, "int", 320, "int", 240, "hwnd", GUICreate("", 0, 0), "int", 1)
DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_DRIVER_CONNECT, "int", 0, "int", 0)
DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_SCALE, "int", 1, "int", 0)
DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_OVERLAY, "int", 1, "int", 0)
DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_PREVIEW, "int", 1, "int", 0)
DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_SET_PREVIEWRATE, "int", 1, "int", 0)
GUISetState(@SW_DISABLE)
Local $time = TimerInit()
While True
  FileDelete($snapfile)
  DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_GRAB_FRAME_NOSTOP, "int", 0, "int", 0)
  DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_FILE_SAVEDIBA, "int", 0, "str", $snapfile)
  If TimerDiff($time) > 900 Then ExitLoop
WEnd
DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_UNICODE_START, "int", 0, "int", 0)
DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_DRIVER_DISCONNECT, "int", 0, "int", 0)
DllClose($avi)
DllClose($user)
EndFunc   ;==>SNAPWEBCAM

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Why do you need another way?

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Why do you need another say?

is not stable!

Share this post


Link to post
Share on other sites

What is the While loop for?

You delete the file and then (over)write the image to the file. Does this make sense?


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Because the first image comes black

Share this post


Link to post
Share on other sites

no solution :thumbsdown:

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Posted Image

NO LOOP

SNAPWEBCAM(@ScriptDir & "\1.bmp")
Func SNAPWEBCAM($snapfile)
    Local Const $WS_CHILD = 0x40000000
    Local Const $WM_CAP_START = 0x400
    Local $WM_CAP_DRIVER_DISCONNECT = $WM_CAP_START + 11
    Local $WM_CAP_DRIVER_CONNECT = $WM_CAP_START + 10
    Local $WM_CAP_UNICODE_START = $WM_CAP_START + 100
    Local $avi = DllOpen("avicap32.dll")
    Local $user = DllOpen("user32.dll")
    Local $cap = DllCall($avi, "int", "capCreateCaptureWindow", "str", "cap", "int", $WS_CHILD, "int", 15, "int", 15, "int", 320, "int", 240, "hwnd", GUICreate("", 0, 0), "int", 1)
    DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_DRIVER_CONNECT, "int", 0, "int", 0)
    GUISetState(@SW_DISABLE)
    SNAP($user, $cap[0], "")
    SNAP($user, $cap[0], "")
    SNAP($user, $cap[0], "")
    SNAP($user, $cap[0], $snapfile)
    DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_UNICODE_START, "int", 0, "int", 0)
    DllCall($user, "int", "SendMessage", "hWnd", $cap[0], "int", $WM_CAP_DRIVER_DISCONNECT, "int", 0, "int", 0)
    DllClose($avi)
    DllClose($user)
EndFunc   ;==>SNAPWEBCAM
Func SNAP($DLL, $cap, $savto)
    Local Const $WM_CAP_START = 0x400
    Local $WM_CAP_FILE_SAVEDIBA = $WM_CAP_START + 25
    Local $WM_CAP_GRAB_FRAME_NOSTOP = $WM_CAP_START + 61
    FileDelete($savto)
    DllCall($DLL, "int", "SendMessage", "hWnd", $cap, "int", $WM_CAP_GRAB_FRAME_NOSTOP, "int", 0, "int", 0)
    DllCall($DLL, "int", "SendMessage", "hWnd", $cap, "int", $WM_CAP_FILE_SAVEDIBA, "int", 0, "str", $savto)
EndFunc   ;==>SNAP

ADD TO MY RAT

http://www.youtube.com/watch?v=cRw6ODFW4q0&feature=youtu.be

Edited by JustBegun

Share this post


Link to post
Share on other sites

Is that a wart on your hand? :whistle:


Spoiler

“Hello, ladies, look at your man, now back to me, now back at your man, now back to me. Sadly, he isn’t me, but if he stopped using ladies scented body wash and switched to Old Spice, he could smell like he’s me. Look down, back up, where are you? You’re on a boat with the man your man could smell like. What’s in your hand, back at me. I have it, it’s an oyster with two tickets to that thing you love. Look again, the tickets are now diamonds. Anything is possible when your man smells like Old Spice and not a lady. I’m on a horse.”

 

Share this post


Link to post
Share on other sites

Is that a wart on your hand? :whistle:

:bye::D

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