Tuning WebTV for Windows

[This is preliminary documentation and subject to change.]

Once your application has a reference to WebTV for Windows, as discussed in Getting a Pointer to WebTV for Windows, it can call the ITVViewer::Tune method to cause WebTV for Windows to display a new channel.

The following line of code tunes WebTV for Windows to the specified channel and tuning space. In this example, the audio and video subchannel values are each specified as –1, which causes WebTV for Windows to use default values.

TVX->Tune(iTuningSpace, iChannel,-1,-1,NULL); 
 

The ITVViewer interface offers two other tuning-related methods, ITVViewer::GetCurrentTuningInfo and ITVViewer::GetPreviousTuningInfo. GetCurrentTuningInfo returns information about the channel WebTV for Windows is currently tuned to, and GetPreviousTuningInfo returns information about the channel tuned to just previously.

The following example uses GetPreviousTuningInfo and Tune methods to implement a back button, which when clicked tunes WebTV for Windows to the previous channel.

void CMyApp::BackButton() 
{
  long lTuningSpacePrev;
  long lChannelNumberPrev;
  long lAudioStreamPrev;
  long lVideoStreamPrev;
  CComBSTR bstrIPAddressPrev;
 
  TVX->GetPreviousTuningInfo(&lTuningSpacePrev, &lChannelNumberPrev,
            &lVideoStreamPrev, &lAudioStreamPrev, &bstrIPAddressPrev);
 
  TVX->Tune(lTuningSpacePrev, lChannelNumberPrev,
            lVideoStreamPrev, lAudioStreamPrev, bstrIPAddressPrev);
}