Topic: WebCamera

Whether it is necessary from  12.5 to check up the camera and a microphone are connected.
In an ideal to check up operation.
There is a ready decision?


Re: WebCamera

So at all of us turned sour?
There is an idea.
Somewhere here:


All devices are registered.
It is necessary to transverse under the list and to find the device, where
Data = "usbvideo" (Name = "Service")
To take from "FriendlyName" device name and to look, whether it is connected to USB.
I.e. now the task to receive names connected  (it can be possible to receive and device type - then in registry it is not necessary ).


Re: WebCamera



Re: WebCamera


Re: WebCamera

string ls_message
OLEObject ole_wsh
ole_wsh = CREATE OLEObject
ole_wsh. ConnectToNewObject ("MSScriptControl. ScriptControl")
ole_wsh. Language = "vbscript"
ole_wsh. AddCode (' Function FindWebCamera () ~r~n ' AND
+ ' USBdevice = "" ~r~n ' AND
+ ' strComputer = "." ~r~n ' AND
+ ' Set objWMIService = ' AND
+ ' GetObject ("winmgmts: \\" &strComputer AND "\root\cimv2") ~r~n ' AND
+ ' Set colItems = ' AND
+ ' objWMIService. ExecQuery ("Select * from Win32_PnPEntity") ~r~n ' AND
+ ' For Each objItem in colItems~r~n ' AND
+ ' USBdevice = USBdevice AND "," &objItem.Name AND "###" &objItem.Service AND "###" &objItem.Status~r~n ' AND
+ ' Next~r~n ' AND
+ ' FindWebCamera = USBdevice~r~n ' AND
+ ' End Function ')
ls_message = ole_wsh. Eval ("FindWebCamera")
ole_wsh. DisconnectObject ()
DESTROY ole_wsh
MessageBox ("USB", ls_message)

This script finds all devices and the status ("OK" or "Error").
Among the text is somewhere

Name Camer###usbvideo###OK

The name to us, actually is not necessary. It is necessary to check up simply

IF Pos (ls_message, ' usbvideo###OK ')> 0 THEN
//the Camera works
//the Camera does not work

At any camera connected through USB will be usbvideo . The problem that if the camera is not connected through USB, and is built in the Notebook (in mine Laptope) it looks so:

Name Camer###rtsuvc###OK

Where rtsuvc - something . How to learn, what it really camera?
other method:
Through functions API

Function Long SendMessage (Long hwnd, Long wMsg, Long wParam, Long lparam) LIBRARY "user32" Alias for "SendMessageA"
Function Long capCreateCaptureWindow (String a, Long b, Long c, Long d, Long e, Long f, Long g, Long h) LIBRARY "avicap32.dll" Alias for "capCreateCaptureWindowA"
Function long capDriverConnect (Long a, Long b) LIBRARY "avicap32.dll"

But mind does not suffice to fasten to .
I ask the help of collective intelligence...