supagusti Posted January 26, 2013 Share Posted January 26, 2013 This UDF doesn't work on any OS above XP (meaning Vista/7/and probably 8). I don't think so - I did this under Windows 7 SP1 X64 and it works fine without any additional dlls. I'm using some kind of Creative Live! Cam (VFD230) expandcollapse popup#include #include Opt("GUIOnEventMode", 1) ; Change to OnEvent mode Opt('MustDeclareVars', 1) Opt('GUICloseOnESC',0) Global $mainWindow Global $webCamHandler Global $StatusBar mainWindow() _webcamClose($webCamHandler) Exit Func mainWindow() local $filemenu,$actionmenu local $exititem,$webCamSnapItem,$webCamRecStartItem,$webCamRecStopItem $mainWindow=GUICreate("Webcam" , 820, 660) GUISetBkColor(0xFFFFFF) $filemenu = GUICtrlCreateMenu("&File") $exititem = GUICtrlCreateMenuItem("Exit", $filemenu) $actionmenu = GUICtrlCreateMenu("&Action") $webCamSnapItem = GUICtrlCreateMenuItem("Take Snapshot", $actionmenu) $webCamRecStartItem = GUICtrlCreateMenuItem("Start Recording", $actionmenu) $webCamRecStopItem = GUICtrlCreateMenuItem("Stop Recording", $actionmenu) $StatusBar = _GUICtrlStatusBar_Create($mainWindow) GUISetState() GUISetOnEvent($GUI_EVENT_CLOSE, "_CLOSEClicked",$mainWindow) GUICtrlSetOnEvent($exititem, "_CLOSEClicked") GUICtrlSetOnEvent($webCamSnapItem, "_webCamSnapshot") GUICtrlSetOnEvent($webCamRecStartItem, "_webCamRecStart") GUICtrlSetOnEvent($webCamRecStopItem, "_webCamRecStop") $webCamHandler=_WebcamOpen($mainWindow, 10,10, 800, 600,1) ConsoleWrite("$webCamHandler="&$webCamHandler&@CRLF) while 1 WEnd EndFunc ;==> mainWindow() ; ============================================================================= ; _webCamSnapshot ; ============================================================================= func _webCamSnapshot() ConsoleWrite("_webCamSnap started...") local $ergebnis=_WebcamSnap($webCamHandler, "$snapshot.BMP") if $ergebnis=1 then ConsoleWrite("...Success!"&@CRLF) Else ConsoleWrite("...Error:-("&@CRLF) EndIf EndFunc; ==> _webCamSnapshot ; ============================================================================= ; _webCamRecStart ; ============================================================================= func _webCamRecStart() ConsoleWrite("_webCamRecStart started..."&@CRLF) local $ergebnis= _WebcamRecordStart("$video.avi", $webCamHandler) if $ergebnis=1 then ConsoleWrite("...Success!"&@CRLF) _GUICtrlStatusBar_SetText($StatusBar, "Recording: ON") Else ConsoleWrite("...Error:-("&@CRLF) EndIf EndFunc; ==> _webCamRecStart ; ============================================================================= ; _webCamRecStop ; ============================================================================= func _webCamRecStop() ConsoleWrite("_webCamRecStop started..."&@CRLF) local $ergebnis=_WebcamRecordStop($webCamHandler) if $ergebnis=1 then ConsoleWrite("...Success!"&@CRLF) _GUICtrlStatusBar_SetText($StatusBar, "Recording: OFF") Else ConsoleWrite("...Error:-("&@CRLF) EndIf EndFunc; ==> _webCamRecStop ; ============================================================================= ; _CLOSEClicked ; ============================================================================= func _CLOSEClicked() Exit EndFunc;==> _CLOSEClicked But I also have some weird behavior regarding recording .... it works, but the .avi is huge! Link to comment Share on other sites More sharing options...
Chimaera Posted March 20, 2013 Share Posted March 20, 2013 (edited) I use this to test a webcam works but i have noticed odd behaviour with it I run it like this $gui = GUICreate("Test", 322, 242) $camera = _WebcamOpen($gui, 1, 1, 320, 240) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then _WebcamClose($camera) Exit EndIf Sleep(100) WEnd Which opens the webcam fine but you can only do it once, a reboot is needed to view it again? Anyone able to make a guess why? EDIT: It crossed my mind whether the Dll's needed closing so ive added that and ill test tomorrow at work Edited March 20, 2013 by Chimaera If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
Nufan1121 Posted July 31, 2013 Share Posted July 31, 2013 Sorry for bumping an old thread but i'm facing a few problems in regards to this code.. My aim is to include a webcam inside of my GUI under a 'Webcam' tab in a tab menu. The tab menu is already full of different technician aiding codes like mic test, driver install menus, benchmark tests etc. My problems when using the Webcam au3 are as follows: 1. For either my like of knowledge or simple blindsided-ness i can't seem to get the webcam to 'embed' within the gui. At best i can have it included in the main gui but it doesn't switch through tabbed windows, it remains 'ontop' of the entire GUI. 2. When i give up and just accept it's ontop for now it only shows a picture one time. Next load up it shows a black screen and requires selection of a video device. Was this due to the none-DLL closes Chimera was talking about? Any help would be appreciated =] or a simple point in the right direction! Regards Nufan. Link to comment Share on other sites More sharing options...
tonycst Posted November 12, 2013 Share Posted November 12, 2013 (edited) Problem. For some reasons i no longer able to use this script. I constantly get this window asking to select Video Source After hours of goggling and trying different settings, i found this. I opened Skype, previewed my face from there and closed it. Then script was finally able to use my webcam I suspect that somewhere something did not turn it off properly. Do you guys know the fix ? Edited November 12, 2013 by tonycst Link to comment Share on other sites More sharing options...
tonycst Posted November 13, 2013 Share Posted November 13, 2013 bump Link to comment Share on other sites More sharing options...
Celtic88 Posted November 13, 2013 Share Posted November 13, 2013 Try this code Link to comment Share on other sites More sharing options...
tonycst Posted November 13, 2013 Share Posted November 13, 2013 Thanks allot Link to comment Share on other sites More sharing options...
rickjames Posted November 10, 2014 Share Posted November 10, 2014 Hello, everyone. I believe I have found the reason for having the video source popup with Windows 7 /8... It relates to UAC and Run as Admin approach. If I run the script or compiled .exe as ADMIN, it always works AFTER I have initially selected a default device via that popup box. The good news is that the default device can be pre-configured, as it is simply a registry value in HKLM (which explains why if NOT run as admin - will never save the default selection via the popup, neither will succeed to read the registry if it is already setup)!!! So this is what I have done to figure it out and being able to set the default capture device on other machines to successfully use the webcam UDF and never have the video source popup appear (just remember that it ONLY works when run as admin): 1. Run the script as Admin, got the popup to select a default device as expected (even with only one webcam present); 2. Clicked the OK button - script completed successfully; 3. Used regedit to open and navigate to: HKLMSYSTEMCurrentControlSetControlMediaResourcesmsvideoMSVideo.VFWWDM A new STRING (REG_SZ) Value was created, named "DevicePath" (without the quotes), and its DATA is: ?root#image#0000#{GUID}global ... where GUID is the unique ID of the webcam you have on your device. It can be verified/found in: HKLMSYSTEMCurrentControlSetControlMediaCategories{GUID}Name(REG_SZ)=Capture There are many GUID registry keys there, but the correct one has a VALUE "Name"=Capture One good reference to point me in this direction was here: http://stackoverflow.com/questions/10721085/webcam-video-source-dialog-comes-up So at this point I don't think the script fails to close the dll or disconnect the driver after done... Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now