IltmmVideoProcAmp::GetRange Example for C++

HRESULT GetCaptureVideoFormatCount(IltmmCapture *pCapture)
{
   HRESULT   hr;
   long      lMin, lMax, lSteppingDelta, lDefault, lCapsFlags;
   long      lFlags, lVal;

   IltmmVideoProcAmp* pVidProcAmp = NULL;

   // try to get the capture object's VideoProAmp object
   hr = pCapture->get_VideoProcAmp(&pVidProcAmp);
   if (FAILED(hr))
      return hr;

   // try to get the range info for the proc amp
   hr = pVidProcAmp->GetRange(ltmmVideoProcAmp_Brightness,
                               &lMin, &lMax, &lSteppingDelta,
                               &lDefault, &lCapsFlags);
   if (FAILED(hr))
   {
      // release the video proc amp object
      pVidProcAmp->Release();
      return hr;
   }

   // try to get the brightness value and (auto or manual) settings 
   hr = pVidProcAmp->Get(ltmmVideoProcAmp_Brightness,
                          &lVal, &lFlags);
   if (FAILED(hr))
   {
      // release the video proc amp object
      pVidProcAmp->Release();
      return hr;
   }

   // set the brightness value to a manual setting of current+10 
   lVal = min(lVal + 10, lMax);
   hr = pVidProcAmp->Set(ltmmVideoProcAmp_Brightness,
                          lVal, ltmmVideoProcAmp_Flags_Manual);
   if (FAILED(hr))
   {
      // release the video proc amp object
      pVidProcAmp->Release();
      return hr;
   }

   // release the video proc amp object
   pVidProcAmp->Release();

   return S_OK;
}