IltmmConvert::get_EnableStillCapture Example for C
// This function would be called before start the conversion process
void BeforeConversion()
{
long lWnd = 0;
ltmmSizeMode lSizeMode;
long lVideoH, lVideoW, lWndLeft, lWndTop, lWndW, lWndH;
long lLimit;
VARIANT_BOOL vb;
BSTR bstrLog;
IltmmConvert_get_VideoWindowHandle (g_convert, &lWnd);
if (lWnd)
{
IltmmConvert_get_VideoWidth (g_convert, &lVideoW);
IltmmConvert_get_VideoHeight (g_convert, &lVideoH);
IltmmConvert_get_VideoWindowWidth (g_convert, &lWndW);
IltmmConvert_get_VideoWindowHeight (g_convert, &lWndH);
IltmmConvert_get_VideoWindowLeft (g_convert, &lWndLeft);
IltmmConvert_get_VideoWindowTop (g_convert, &lWndTop);
IltmmConvert_get_VideoWindowSizeMode (g_convert, &lSizeMode);
if (((lVideoW > lWndW) && (lVideoH > lWndH)) && (lSizeMode != ltmmFit))
IltmmConvert_put_VideoWindowSizeMode (g_convert, ltmmFit);
else if ((lVideoW < lWndW) && (lVideoH < lWndH))
IltmmConvert_put_VideoWindowSizeMode (g_convert, ltmmStretch);
IltmmConvert_SetVideoWindowPos (g_convert, lWndLeft, lWndTop, lWndW, lWndH);
}
IltmmConvert_put_EnableStillCapture (g_convert, VARIANT_TRUE);
IltmmConvert_get_StillCaptureLimit (g_convert, &lLimit);
if (lLimit <= 1000)
IltmmConvert_put_StillCaptureLimit (g_convert, 10000);
IltmmConvert_get_FullScreenMode (g_convert, &vb);
if (vb == VARIANT_TRUE)
{
// Just to show how to use put_FullScreenMode
IltmmConvert_ToggleFullScreenMode (g_convert);
// Use put_FullScreenMode(VARIANT_FALSE) to turn off the full screen mode
IltmmConvert_put_FullScreenMode (g_convert, VARIANT_FALSE);
}
bstrLog = SysAllocString(L"C:\\convert.log");
IltmmConvert_OpenLogFile (g_convert, bstrLog, ltmmLogFile_GeneralInfo);
SysFreeString(bstrLog);
}
// This function would be called to saves a snapshot from the running stream to a file
void TakeSnapShots()
{
static int i = 0;
VARIANT_BOOL vb;
BSTR bstFileName;
IltmmConvert_get_EnableStillCapture (g_convert, &vb);
if (vb == VARIANT_TRUE)
{
char szFileName[100];
wsprintf(szFileName, "c:\\SnapShot%d.cmp", i++);
bstFileName = T2OLE(szFileName);
IltmmConvert_SaveStillBitmap (g_convert, bstFileName, ltmmConvert_StillFormat_CMP, 2, 0, -1);
}
}
// This function would be called after the conversion process is finished.
void EndConversion()
{
IltmmConvert_CloseLogFile (g_convert);
}