L_WiaIsVideoPreviewAvailable

Summary

Determines whether there is an available video preview.

Syntax

#include "ltwia.h"

L_LTWIA_API L_BOOL EXT_FUNCTION L_WiaIsVideoPreviewAvailable(hSession)

Parameters

HWIASESSION hSession

Handle to an existing WIA session. This handle is obtained by calling the L_WiaInitSession function.

Returns

Value Meaning
TRUE The video preview feature is available and the user can start it.
FALSE The video preview feature is not available.

Comments

This feature is available in version 16 or higher.

If the function L_WiaIsVideoPreviewAvailable is called and succeeded then this function will return TRUE, otherwise it will return FALSE.

Required DLLs and Libraries

Platforms

Since WIA does not support video devices in Windows Server 2003, Windows Vista or later, then this function will only work with Windows XP or earlier operating systems.

See Also

Functions

Topics

Example

L_INT WiaIsVideoPreviewAvailableExample(HWIASESSION hSession, HWND hWnd) 
{ 
   L_TCHAR szSavedFileName[MAX_PATH] = TEXT(""); 
   L_TCHAR szImagesDirectory[MAX_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 = L_WiaSelectDeviceDlg(hSession, hWnd, WiaDeviceTypeStreamingVideo, L_WIA_SELECT_DEVICE_NODEFAULT); 
   if(nRet != WIA_SUCCESS) 
      return nRet; 
 
   nRet = L_WiaStartVideoPreview(hSession, hWnd, FALSE); 
   if (nRet != WIA_SUCCESS) 
      return nRet; 
 
   bAvailable = L_WiaIsVideoPreviewAvailable(hSession); 
   if(!bAvailable) 
   { 
      MessageBox(hWnd,  
         TEXT("No streaming video available."), 
         TEXT("ERROR"), 
         MB_OK | MB_ICONERROR); 
 
      L_WiaEndVideoPreview(hSession); 
      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 = L_WiaResizeVideoPreview(hSession, TRUE); 
   if(nRet != WIA_SUCCESS) 
      return nRet; 
 
   nRet = L_WiaAcquireImageFromVideo(hSession, szSavedFileName, &uLength); 
   if(nRet != WIA_SUCCESS && nRet == ERROR_BUFFER_TOO_SMALL) 
   { 
      L_WiaEndVideoPreview(hSession); 
      nRet = L_WiaGetRootItem(hSession, NULL, (L_VOID**)&pRootItem); 
      if(nRet != WIA_SUCCESS) 
         return FALSE; 
 
      nRet = L_WiaGetPropertyString(hSession, 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(hWnd, 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(hWnd, szMsg, TEXT("Captured Image Path"), MB_OK | MB_ICONINFORMATION); 
 
   L_WiaEndVideoPreview(hSession); 
   return SUCCESS; 
} 
Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS WIA C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.