IltmmAudioInputs::put_Enable Example for C++

void EnableAudioInput(IltmmAudioInputs *pAudioInputs)
{
   VARIANT_BOOL bEnable;
   long lCount;

   // Disable all inputs:
   pAudioInputs->put_Enable(VARIANT_FALSE);

    // Now enable the first input:
   pAudioInputs->get_Count(&lCount); 
   if (lCount > 0)
   {
      IltmmAudioInput *pAudioInput = NULL; 
      HRESULT hr = pAudioInputs->Item(0, &pAudioInput); 
      if (SUCCEEDED(hr) && pAudioInput) 
      {
         pAudioInput->put_Enable(VARIANT_TRUE);
      }
      pAudioInput->Release();
   }

   // Check if the input is enabled:
   pAudioInputs->get_Enable(&bEnable);
   if (bEnable == VARIANT_TRUE)
      AfxMessageBox(TEXT("An input is enabled"));
   else
      AfxMessageBox(TEXT("All inputs are disabled"));
}