LWia::IsVideoPreviewAvailable

#include "ltwrappr.h"

virtual L_BOOL LWia::IsVideoPreviewAvailable()

Indicates whether there is an available video preview.

Returns

Value Meaning
TRUE The video preview feature is available and can be started.
FALSE The video preview feature is not available.

Comments

This feature is available in LEADTOOLS version 16 or higher.

If [LWia:IsVideoPreviewAvailable is called and succeeds it will return TRUE; otherwise, it will return FALSE.

Required DLLs and Libraries

See Also

Functions

Topics

Example

L_INT LWIA__IsVideoPreviewAvailableExample() 
{ 
   LWia MyClass; 
   L_TCHAR szSavedFileName[MAX_PATH]; 
   lstrcpy(szSavedFileName,MAKE_IMAGE_PATH(TEXT(""))); 
   L_TCHAR szImagesDirectory[MAX_PATH] ; 
   lstrcpy(szImagesDirectory,MAKE_IMAGE_PATH(TEXT(""))); 
   L_TCHAR szMsg[MAX_PATH] = TEXT(""); 
   L_BOOL bAvailable = FALSE; 
   L_SIZE_T uLength = MAX_PATH; 
   IWiaItem * pRootItem = NULL; 
   L_INT nRet; 
 
   /* Select video streaming device first */ 
   nRet = MyClass.SelectDeviceDlg(WiaDeviceTypeStreamingVideo, L_WIA_SELECT_DEVICE_NODEFAULT); 
   if(nRet != WIA_SUCCESS) 
      return nRet; 
 
   nRet = MyClass.StartVideoPreview(FALSE); 
   if (nRet != WIA_SUCCESS) 
      return nRet; 
 
   bAvailable = MyClass.IsVideoPreviewAvailable(); 
   if(!bAvailable) 
   { 
      MessageBox(NULL,  
                 TEXT("No streaming video available, please call MyClass.StartVideoPreview first"), 
                 TEXT("ERROR"), 
                 MB_OK | MB_ICONERROR); 
 
      MyClass.EndVideoPreview(); 
      return FALSE; 
   } 
 
   /* Resize the video preview area to fit the parent window */ 
   // I am calling this resize function here only for demonstration purposes, but you 
   // should call it in your window resize event. 
   nRet = MyClass.ResizeVideoPreview(TRUE); 
   if(nRet != WIA_SUCCESS) 
      return nRet; 
 
   nRet = MyClass.AcquireImageFromVideo(szSavedFileName, &uLength); 
   if(nRet != WIA_SUCCESS && nRet == ERROR_BUFFER_TOO_SMALL) 
   { 
      MyClass.EndVideoPreview(); 
      nRet = MyClass.GetRootItem(NULL, (L_VOID**)&pRootItem); 
      if(nRet != WIA_SUCCESS) 
         return FALSE; 
 
      nRet = MyClass.GetPropertyString(pRootItem, NULL, WIA_DPV_IMAGES_DIRECTORY, szImagesDirectory, &uLength); 
      if(nRet == WIA_SUCCESS) 
      { 
         wsprintf(szMsg,  
            TEXT("Provided string buffer is too small to be updated.\n") 
            TEXT("But still an image was saved to the following directory:\n\n%s"), 
            szImagesDirectory); 
 
         MessageBox(NULL, szMsg, TEXT("ERROR"), MB_OK | MB_ICONERROR); 
      } 
 
      return FALSE; 
   } 
 
   wsprintf(szMsg,  
      TEXT("Captured still image was saved to the following path:\n\n%s"), 
      szSavedFileName); 
 
   MessageBox(NULL, szMsg, TEXT("Captured Image Path"), MB_OK | MB_ICONINFORMATION); 
 
   MyClass.EndVideoPreview(); 
   return SUCCESS; 
} 
Help Version 21.0.2021.7.2
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS WIA C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.