AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Ayuda / WLanguage / Funciones WLanguage / Controles, páginas y ventanas / Funciones de video
  • Video control: Initialization
VideoSetDriver (Example)
Video control: Initialization
This example is used to initialize a Video control according to the computer drivers.
arrCameraDrivers is array of strings
nIndex is int
 
// Retrieve the name of the camera driver that was used beforehand
sCurrentDriver is string = LoadParameter(CAM_WEBCAM..FullName, CAM_WEBCAM..Driver)
 
// Llist of available camera drivers in the following format:
// Name of Driver 1> + TAB + <Version of Driver 1> + CR + ...
sListVideoDriver is string = VideoListDriver(viDirectShow))
// or CameraListDriver(viDirectShow)
// The list of drivers is stored in an array variable
StringToArray(sListVideoDriver, arrCameraDrivers, RC, TAB)
// Is there at least one camera driver or WebCam?
SWITCH arrCameraDrivers.Count
CASE 0
// None
ToastDisplay("No camera driver was found on the computer, " +
"the control was disabled", toastShort, vaMiddle,haCenter, LightRed)
CAM_WEBCAM.State = Grayed
CASE 1
// a single driver: take it
nIndex = 1
 
OTHER CASE
// several drivers
// check whether the driver that was stored beforehand is found in the list
nIndex = ArraySeek(arrCameraDrivers, asLinear, sCurrentDriver)
IF nIndex < 1 THEN
// Not found: take the first one in the list
nIndex=1
END
END
 
// A driver other than the control one is selected?
IF nIndex>0 _AND_ NOT CAM_WEBCAM..Driver = arrCameraDrivers[nIndex] _AND_ ...
// Change the driver used (and check whether the change is operating)
NOT VidéoChangeDriver(CAM_WEBCAM, arrCameraDrivers[nIndex]) THEN
//or NOT CameraChangeDriver(CAM_WEBCAM, arrCameraDrivers[nIndex])
ToastDisplay("Unable to use the camera driver " +
arrCameraDrivers[nIndex] + ", the control was disabled" + CR +
ErrorInfo(),toastShort, vaMiddle, haCenter, LightRed)
CAM_WEBCAM.State = Grayed
END
 
// Store the driver
// This same paramer must be saved if a window option is used to change camera
// in order for this camera driver to be taken into account by default
SaveParameter(CAM_WEBCAM.FullName, CAM_WEBCAM.Driver)
Versión mínima requerida
  • Versión 9
Esta página también está disponible para…
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 27/05/2022

Señalar un error o enviar una sugerencia | Ayuda local