IltmmDVDControl::GetButtonAtPosition Example for C++

void CMainFrame::OnDvdcontrolPause() 
{ 
   HRESULT hr; 
   hr = m_pDVD->Pause(VARIANT_TRUE); 
} 
 
void CMainFrame::OnDvdcontrolPlayChapter() 
{ 
   HRESULT hr;    
   hr = m_pDVD->PlayChapter(1); 
} 
 
void CMainFrame::OnDvdcontrolPlayNextChapter() 
{ 
   HRESULT hr; 
   hr = m_pDVD->PlayNextChapter(); 
} 
 
void CMainFrame::OnDvdcontrolPlayPrevChapter() 
{ 
   HRESULT hr; 
   hr = m_pDVD->PlayPrevChapter(); 
} 
 
void CMainFrame::OnDvdcontrolReplayChapter() 
{ 
   HRESULT hr; 
   hr = m_pDVD->ReplayChapter(); 
} 
 
void CMainFrame::OnDvdcontrolResume() 
{ 
   HRESULT hr; 
   hr = m_pDVD->Resume(); 
} 
 
void CMainFrame::OnDvdcontrolShowMenu() 
{ 
   HRESULT hr; 
   hr = m_pDVD->ShowMenu(ltmmDVD_MENU_Root); 
} 
 
void CMainFrame::OnDvdcontrolStop() 
{ 
   HRESULT hr; 
   hr = m_pDVD->Stop(); 
} 
 
void CMainFrame::OnDvdcontrolPlayAtTime() 
{ 
   ltmmDVD_HMSF_TIMECODE Time; 
   Time.bHours = 0; 
   Time.bMinutes = 10; 
   Time.bSeconds = 0; 
   Time.bFrames = 0; 
   HRESULT hr; 
   long *plTime = (long*)&Time; 
   hr = m_pDVD->PlayAtTime(*plTime); 
} 
 
void CMainFrame::OnDvdcontrolPlayBackwards() 
{ 
   HRESULT hr; 
   hr = m_pDVD->PlayBackwards(5); 
} 
 
void CMainFrame::OnDvdcontrolPlayForwards() 
{ 
   HRESULT hr; 
   hr = m_pDVD->PlayForwards(5); 
} 
 
void CMainFrame::OnDvdcontrolPlayAtTimeInTitle() 
{ 
   ltmmDVD_HMSF_TIMECODE Time; 
   Time.bHours = 0; 
   Time.bMinutes = 30; 
   Time.bSeconds = 0; 
   Time.bFrames = 0; 
   HRESULT hr; 
   long *plTime = (long*)&Time; 
   hr = m_pDVD->PlayAtTimeInTitle(1, *plTime); 
} 
 
void CMainFrame::OnDvdcontrolChaptersPlayChapterInTitle() 
{ 
   HRESULT hr; 
   hr = m_pDVD->PlayChapterInTitle(1, 3); 
} 
 
void CMainFrame::OnDvdcontrolChaptersPlayChapterAutoStop() 
{ 
   HRESULT hr; 
   hr = m_pDVD->PlayChaptersAutoStop(1, 2, 5); 
} 
 
void CMainFrame::OnDvdcontrolChaptersPlayTitle() 
{ 
   HRESULT hr; 
   hr = m_pDVD->PlayTitle(2); 
} 
 
void CMainFrame::OnDvdcontrolChaptersPlayPeriod() 
{ 
   HRESULT hr; 
   ltmmDVD_HMSF_TIMECODE Time1, Time2; 
   Time1.bHours = 0; 
   Time1.bMinutes = 30; 
   Time1.bSeconds = 0; 
   Time1.bFrames = 0; 
   Time2.bHours = 0; 
   Time2.bMinutes = 30; 
   Time2.bSeconds = 20; 
   Time2.bFrames = 0; 
   long *plTime1 = (long*)&Time1; 
   long *plTime2 = (long*)&Time2; 
   hr = m_pDVD->PlayPeriodInTitleAutoStop(1, *plTime1, *plTime2); 
} 
 
void CMainFrame::OnDvdcontrolReturnFromSubMenu() 
{ 
   HRESULT hr; 
   hr = m_pDVD->ReturnFromSubmenu(); 
} 
 
void CMainFrame::OnDvdcontrolStillOff() 
{ 
   HRESULT hr; 
   hr = m_pDVD->StillOff(); 
} 
 
void CMainFrame::OnDvdcontrolButtonsActivateButton() 
{ 
   HRESULT hr; 
   hr = m_pDVD->ActivateButton(); 
} 
 
void CMainFrame::OnDvdcontrolButtonsActivateAtPosition() 
{ 
   HRESULT hr; 
   hr = m_pDVD->ActivateAtPosition(10, 10); 
} 
 
void CMainFrame::OnDvdcontrolButtonsSelectAtPosition() 
{ 
   HRESULT hr; 
   hr = m_pDVD->SelectAtPosition(10, 10); 
} 
 
void CMainFrame::OnDvdcontrolButtonsSelectAndActivateButton() 
{ 
   HRESULT hr;   hr = m_pDVD->SelectAndActivateButton(1); 
} 
 
void CMainFrame::OnDvdcontrolButtonsSelectButton() 
{ 
   HRESULT hr; 
   long  lButton; 
   hr = m_pDVD->GetButtonAtPosition(10, 10, &lButton); 
   if (FAILED(hr)) 
      return; 
   hr = m_pDVD->SelectButton(lButton); 
} 
 
void CMainFrame::OnDvdcontrolButtonsSelectRelativeButton() 
{ 
   HRESULT hr; 
   hr = m_pDVD->SelectRelativeButton(ltmmDVD_Relative_Right); 
} 
 
void CMainFrame::OnDvdcontrolSetDvdDirectory() 
{ 
   HRESULT hr; 
   hr = m_pDVD->put_DVDDirectory(MAKE_MEDIA_PATH("video_ts")); 
} 
 
void CMainFrame::OnDvdcontrolAcceptParentalLevelChange() 
{ 
   HRESULT hr; 
   hr = m_pDVD->AcceptParentalLevelChange(VARIANT_TRUE); 
} 
 
void CMainFrame::OnDvdcontrolNotifyParentalLevelChange() 
{ 
   HRESULT hr; 
   hr = m_pDVD->NotifyParentalLevelChange(VARIANT_TRUE); 
} 
 
void CMainFrame::OnDvdcontrolChangeDvdRegion() 
{ 
   HRESULT hr; 
   hr = m_pDVD->ChangeDVDRegion((long)GetSafeHwnd()); 
} 
 
void CMainFrame::OnDvdInfo() 
{ 
   CDVDInfo dlg; 
   dlg.m_pPlay = m_player; 
   dlg.DoModal(); 
} 
 
// DVD info dialog 
BOOL CDVDInfo::OnInitDialog() 
{ 
   CDialog::OnInitDialog(); 
   if (!m_pPlay) 
      return TRUE; 
    
   HRESULT hr; 
   VARIANT_BOOL vEnabled; 
   BSTR bstrVal; 
   IltmmDVDControl* pDVD = NULL; 
    
   hr = m_pPlay->get_DVDControl(&pDVD); 
   if (FAILED(hr)) 
   { 
      MessageBox(TEXT("No DVD source file available"), TEXT("Error")); 
      return TRUE; 
   } 
 
   long lVal, lButton; 
   hr = pDVD->get_CurrentButton(&lButton); 
   if (SUCCEEDED(hr)) 
   { 
      hr = pDVD->GetButtonWidth(lButton, &lVal); 
      if (SUCCEEDED(hr)) 
         SetDlgItemInt(IDC_EDIT_BUTTONWIDTH, lVal); 
      hr = pDVD->GetButtonHeight(lButton, &lVal); 
      if (SUCCEEDED(hr)) 
         SetDlgItemInt(IDC_EDIT_BUTTONHEIGHT, lVal); 
      hr = pDVD->GetButtonLeft(lButton, &lVal); 
      if (SUCCEEDED(hr)) 
         SetDlgItemInt(IDC_EDIT_BUTTONLEFT, lVal); 
      hr = pDVD->GetButtonTop(lButton, &lVal); 
      if (SUCCEEDED(hr)) 
         SetDlgItemInt(IDC_EDIT_BUTTONTOP, lVal); 
   } 
   hr = pDVD->get_DefaultMenuLanguage(&lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_DEFMENULANGAUGE, lVal); 
   hr = pDVD->put_DefaultMenuLanguage(1033); 
   hr = pDVD->GetNumberOfChapters(0, &lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_NUMBEROFCHAPTERS, lVal); 
   hr = pDVD->get_TotalTitleTime(&lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_TOTALTITLETIME, lVal); 
   hr = pDVD->get_TitleTimecodeFlags(&lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_TITLETIMECODEFLAGS, lVal); 
   hr = pDVD->get_CurrentAngle(&lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_CURANGLE, lVal); 
   hr = pDVD->get_AnglesAvailable(&lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_ANGLESAVAILABLES, lVal); 
   if (lVal > 1) 
      hr = pDVD->put_CurrentAngle(2); 
   hr = pDVD->get_CurrentUOPS(&lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_CURUOPS, lVal); 
   hr = pDVD->GetAudioLanguage(0, &lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_AUDOLANGUAGE, lVal); 
   hr = pDVD->get_CurrentAudioStream(&lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_CURAUDIOSTREAM, lVal); 
   hr = pDVD->get_AudioStreamsAvailable(&lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_AUIOSTREAMSAVAILABLE, lVal); 
   if (lVal > 1) 
      hr = pDVD->put_CurrentAudioStream(2); 
   hr = pDVD->get_CurrentTime(&lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_CURRENTTIME, lVal); 
   hr = pDVD->get_CurrentVolume(&lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_CURRENTVOLUME, lVal); 
   hr = pDVD->get_VolumesAvailable(&lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_VOLUMENSAVAILABLE, lVal); 
   hr = pDVD->get_TitlesAvailable(&lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_TITLESAVAILABLE, lVal); 
   hr = pDVD->IsAudioStreamEnabled(0, &vEnabled); 
   if (SUCCEEDED(hr)) 
      GetDlgItem(IDC_EDIT_ISAUDIOSTREAMENABLED)->SetWindowText((vEnabled == VARIANT_TRUE) ? TEXT("Enabled") : TEXT("Disabled")); 
   hr = pDVD->get_DefaultAudioLanguage(&lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_DEFAUDIOLANG, lVal); 
   hr = pDVD->SelectDefaultAudioLanguage(1033, ltmmDVD_AUD_EXT_Captions); 
   USES_CONVERSION; 
   hr = pDVD->get_DVDDirectory(&bstrVal); 
   if (SUCCEEDED(hr)) 
      GetDlgItem(IDC_EDIT_DVDDIRECTORY)->SetWindowText(bstrVal); 
   hr = pDVD->get_CurrentSubpictureStream(&lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_CURSUBPICSTREAM, lVal); 
   hr = pDVD->get_SubpictureStreamsAvailable(&lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_SUBPICSTREAMAVAILABLE, lVal); 
   if (lVal > 1) 
      hr = pDVD->put_CurrentSubpictureStream(1); 
   hr = pDVD->get_DefaultSubpictureLanguage(&lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_DEFSUBPICLANG, lVal); 
   hr = pDVD->SelectDefaultSubpictureLanguage(1033, ltmmDVD_SP_EXT_Caption_Normal); 
   hr = pDVD->get_CurrentTitle(&lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_CURRENTTITILE, lVal); 
   hr = pDVD->get_DefaultSubpictureLanguageExt(&lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_DEFSUBPICLANGEXT, lVal); 
   hr = pDVD->get_DefaultAudioLanguageExt(&lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_DEFAUDIOLANGEXT, lVal); 
   hr = pDVD->GetSubpictureLanguage(0, &lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_SUBPICLANG, lVal); 
   hr = pDVD->IsSubpictureStreamEnabled(0, &vEnabled); 
   if (SUCCEEDED(hr)) 
      GetDlgItem(IDC_EDIT_ISSUBPICSTREAMENABLE)->SetWindowText((vEnabled == VARIANT_TRUE) ? TEXT("Enabled") : TEXT("Disabled")); 
   hr = pDVD->GetDVDTextLanguageLCID(0, &lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDITD_DVDTEXTLANGLCID, lVal); 
   hr = pDVD->get_DVDTextNumberOfLanguages(&lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_DVDTEXTNUMOFLANG, lVal); 
   hr = pDVD->GetGPRM(0, &lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_GPRM, lVal); 
   hr = pDVD->SetGPRM(0, 1); 
   hr = pDVD->GetDVDTextNumberOfStrings(0, &lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_DVDTEXTNUMOFSTRINGS, lVal); 
   hr = pDVD->get_ButtonsAvailable(&lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_BUTTONSAVAILABLE, lVal); 
   hr = pDVD->get_PlayerParentalLevel(&lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_PLAYERLEVEL, lVal); 
   BYTE *pCountry; 
   hr = pDVD->get_PlayerParentalCountry(&lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_PLAYERCOUNTRY, lVal); 
   pCountry = (BYTE*)&lVal; 
   if ((pCountry[0] != 'U') || 
      (pCountry[1] != 'S')) 
   {      BYTE aRegion[2] = {0}; 
   aRegion[0] = 'U'; 
   aRegion[1] = 'S'; 
   lVal = *((WORD *) aRegion); 
   hr = pDVD->SelectParentalCountry(lVal, NULL, NULL); 
   }      hr = pDVD->GetTitleParentalLevels(-1, &lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_TITLELEVELS, lVal); 
   hr = pDVD->SelectParentalLevel(ltmmDVD_PARENTAL_LEVEL_1, NULL, NULL); 
   hr = pDVD->get_CurrentDomain(&lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_CURDOMAIN, lVal); 
   hr = pDVD->get_CurrentDiscSide(&lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_CURDISCSIDE, lVal); 
   hr = pDVD->get_CurrentChapter(&lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_CURCHAPTER, lVal); 
   hr = pDVD->GetDVDTextStringType(0, 0, &lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_DVDTEXTSTRINGTYPE, lVal); 
   hr = pDVD->get_SubpictureOn(&vEnabled); 
   if (SUCCEEDED(hr)) 
      GetDlgItem(IDC_EDIT_SUBPICON)->SetWindowText((vEnabled == VARIANT_TRUE) ? TEXT("On") : TEXT("Off")); 
   if (vEnabled != VARIANT_TRUE) 
      hr = pDVD->put_SubpictureOn(VARIANT_TRUE); 
   hr = pDVD->GetSPRM(0, &lVal); 
   if (SUCCEEDED(hr)) 
      SetDlgItemInt(IDC_EDIT_SPRM, lVal); 
   hr = pDVD->GetDVDTextString(0, 0, &bstrVal); 
   if (SUCCEEDED(hr)) 
      GetDlgItem(IDC_EDIT_DVDTEXTSTRING)->SetWindowText(bstrVal); 
   hr = pDVD->get_DVDUniqueID(&bstrVal); 
   GetDlgItem(IDC_EDIT_DVDID)->SetWindowText(bstrVal); 
   pDVD->Release(); 
   return TRUE;  // return TRUE unless you set the focus to a control 
   // EXCEPTION: OCX Property Pages should return FALSE 
} 
Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Multimedia C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.