IltmmConvert::get_EnableStillCapture Example for C++
// This function would be called before start the conversion process
void CConvertingDlg::BeforeConversion()
{
long lWnd = 0;
ltmmSizeMode lSizeMode;
long lVideoH, lVideoW, lWndLeft, lWndTop, lWndW, lWndH;
long lLimit;
VARIANT_BOOL vb;
BSTR bstrLog;
m_convert->get_VideoWindowHandle (&lWnd);
if (lWnd)
{
m_convert->get_VideoWidth(&lVideoW);
m_convert->get_VideoHeight(&lVideoH);
m_convert->get_VideoWindowWidth (&lWndW);
m_convert->get_VideoWindowHeight (&lWndH);
m_convert->get_VideoWindowLeft (&lWndLeft);
m_convert->get_VideoWindowTop (&lWndTop);
m_convert->get_VideoWindowSizeMode (&lSizeMode);
if (((lVideoW > lWndW) && (lVideoH > lWndH)) && (lSizeMode != ltmmFit))
m_convert->put_VideoWindowSizeMode (ltmmFit);
else if ((lVideoW < lWndW) && (lVideoH < lWndH))
m_convert->put_VideoWindowSizeMode (ltmmStretch);
m_convert->SetVideoWindowPos (lWndLeft, lWndTop, lWndW, lWndH);
}
m_convert->put_EnableStillCapture (VARIANT_TRUE);
m_convert->get_StillCaptureLimit (&lLimit);
if (lLimit <= 1000)
m_convert->put_StillCaptureLimit (10000);
m_convert->get_FullScreenMode (&vb);
if (vb == VARIANT_TRUE)
{
// Just to show how to use put_FullScreenMode
m_convert->ToggleFullScreenMode ();
// Use put_FullScreenMode(VARIANT_FALSE) to turn off the full screen mode
m_convert->put_FullScreenMode (VARIANT_FALSE);
}
bstrLog = SysAllocString(L"C:\\convert.log");
m_convert->OpenLogFile (bstrLog, ltmmLogFile_GeneralInfo);
SysFreeString(bstrLog);
}
// This function would be called to saves a snapshot from the running stream to a file
void CConvertingDlg::TakeSnapShots()
{
static int i = 0;
VARIANT_BOOL vb;
m_convert->get_EnableStillCapture (&vb);
if (vb == VARIANT_TRUE)
{
char szFileName100];
wsprintf(szFileName, "c:\\SnapShot%d.cmp", i++);
USES_CONVERSION;
BSTR bstFileName = T2OLE(szFileName);
m_convert->SaveStillBitmap (bstFileName, ltmmConvert_StillFormat_CMP, 2, 0, -1);
}
}
// This function would be called after the conversion process is finished.
void CConvertingDlg::EndConversion()
{
m_convert->CloseLogFile ();
}