Available in LEADTOOLS Imaging Pro, Vector, Document, and Medical Imaging toolkits. |
L_WiaIsVideoPreviewAvailable
#include "ltwia.h"
L_LTWIA_API L_BOOL EXT_FUNCTION L_WiaIsVideoPreviewAvailable(hSession)
HWIASESSION hSession; |
/* handle to an existing WIA session */ |
Determines whether there is an available video preview.
Parameter |
Description |
hSession |
Handle to an existing WIA session. This handle is obtained by calling the L_WiaInitSession function. |
Returns
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
LTWIA For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application. |
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: |
L_WiaStartVideoPreview, L_WiaResizeVideoPreview, L_WiaEndVideoPreview, L_WiaAcquireImageFromVideo, L_WiaInitSession, L_WiaEndSession. |
Topics: |
|
|
Example
L_LTWIATEX_API 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; }