IltmmConvert::get_EnableStillCapture Example for C

// This function would be called before start the conversion process

// This function would be called before start the conversion process
LPOLESTR T2OLE(LPCTSTR lpt)
{
   static OLECHAR lpw[512];

   if(!lpt)
      return NULL;

   lpw[0] = L'\0';

   MultiByteToWideChar(CP_ACP, 0, lpt, -1, lpw, 512);

   return lpw;
}

void BeforeConversion(IltmmConvert* pConvert)
{
   long lWnd = 0; 
   ltmmSizeMode lSizeMode; 
   long lVideoH, lVideoW, lWndLeft, lWndTop, lWndW, lWndH; 
   long lLimit; 
   VARIANT_BOOL vb; 
   BSTR bstrLog; 

   IltmmConvert_get_VideoWindowHandle (pConvert, &lWnd); 
   if (lWnd) 
   {

      IltmmConvert_get_VideoWidth (pConvert, &lVideoW); 
      IltmmConvert_get_VideoHeight (pConvert, &lVideoH); 
      IltmmConvert_get_VideoWindowWidth (pConvert, &lWndW); 
      IltmmConvert_get_VideoWindowHeight (pConvert, &lWndH); 
      IltmmConvert_get_VideoWindowLeft (pConvert, &lWndLeft); 
      IltmmConvert_get_VideoWindowTop (pConvert, &lWndTop); 

      IltmmConvert_get_VideoWindowSizeMode (pConvert, &lSizeMode); 
      if (((lVideoW > lWndW) && (lVideoH > lWndH)) && (lSizeMode != ltmmFit)) 
         IltmmConvert_put_VideoWindowSizeMode (pConvert, ltmmFit); 
      else if ((lVideoW < lWndW) && (lVideoH < lWndH)) 
         IltmmConvert_put_VideoWindowSizeMode (pConvert, ltmmStretch); 

      IltmmConvert_SetVideoWindowPos (pConvert, lWndLeft, lWndTop, lWndW, lWndH); 
   }

   IltmmConvert_put_EnableStillCapture (pConvert, VARIANT_TRUE); 
   IltmmConvert_get_StillCaptureLimit (pConvert, &lLimit); 
   if (lLimit <= 1000) 
      IltmmConvert_put_StillCaptureLimit (pConvert, 10000); 


   IltmmConvert_get_FullScreenMode (pConvert, &vb); 
   if (vb == VARIANT_TRUE) 
   {
      // Just to show how to use put_FullScreenMode
      IltmmConvert_ToggleFullScreenMode (pConvert); 

      // Use put_FullScreenMode(VARIANT_FALSE) to turn off the full screen mode
      IltmmConvert_put_FullScreenMode (pConvert, VARIANT_FALSE); 
   }

   bstrLog = SysAllocString(L"C:\\convert.log");
   IltmmConvert_OpenLogFile (pConvert, bstrLog, ltmmLogFile_GeneralInfo); 
   SysFreeString(bstrLog); 
}

// This function would be called after the conversion process is finished. 
void EndConversion(IltmmConvert* pConvert)
{
   IltmmConvert_CloseLogFile (pConvert); 
}

// This function would be called to saves a snapshot from the running stream to a file
L_MULTIMEDIATEX_API void IltmmConvert_get_EnableStillCapture_Example (IltmmConvert* pConvert)
{
   static int i = 0; 
   VARIANT_BOOL vb; 
   BSTR bstFileName; 

   IltmmConvert_get_EnableStillCapture (pConvert, &vb); 
   if (vb == VARIANT_TRUE) 
   {
      char szFileName[100]; 

      wsprintf(szFileName, "c:\\SnapShot%d.cmp", i++);

      bstFileName = T2OLE(szFileName); 

      IltmmConvert_SaveStillBitmap (pConvert, bstFileName, ltmmConvert_StillFormat_CMP, 2, 0, -1); 
   }
}