IltmmDVDControl::GetButtonAtPosition Example for C

IltmmDVDControl* pDVD = NULL;  
 
LPTSTR OLE2T(LPCOLESTR lpw) 
{ 
   static TCHAR lpt[512]; 
 
   if(!lpw) 
      return NULL; 
 
   lpt[0] = _T('\0'); 
 
   WideCharToMultiByte(CP_ACP, 0, lpw, -1, lpt, 512, NULL, NULL); 
 
   return lpt; 
} 
 
HRESULT ShowDVDInfo(IltmmPlay* pPlayer, HWND hWnd)  
{ 
	HRESULT hr;  
	char    szVal[256];  
	BYTE *pCountry;  
	VARIANT_BOOL vEnabled;  
	BSTR bstrVal;  
 
	long lVal, lButton;  
 
	//USES_CONVERSION;  
	hr = IltmmPlay_get_DVDControl (pPlayer, &pDVD);  
	if (FAILED(hr))  
	{ 
		MessageBox(hWnd, "No DVD source file available", "Error", 0);  
		return TRUE;  
	} 
 
	hr = IltmmDVDControl_get_CurrentButton (pDVD, &lButton);  
	if (SUCCEEDED(hr))  
	{ 
		hr = IltmmDVDControl_GetButtonWidth (pDVD, lButton, &lVal);  
		if (SUCCEEDED(hr))  
		{ 
			wsprintf(szVal, "%d", lVal);  
			MessageBox(hWnd, szVal, "ButtonWidth", 0);  
		} 
 
		hr = IltmmDVDControl_GetButtonHeight (pDVD, lButton, &lVal);  
		if (SUCCEEDED(hr))  
		{ 
			wsprintf(szVal, "%d", lVal);  
			MessageBox(hWnd, szVal, "ButtonHeight", 0);  
		} 
 
		hr = IltmmDVDControl_GetButtonLeft (pDVD, lButton, &lVal);  
		if (SUCCEEDED(hr))  
		{ 
			wsprintf(szVal, "%d", lVal);  
			MessageBox(hWnd, szVal, "ButtonLeft", 0);  
		} 
 
		hr = IltmmDVDControl_GetButtonTop (pDVD, lButton, &lVal);  
		if (SUCCEEDED(hr))  
		{ 
			wsprintf(szVal, "%d", lVal);  
			MessageBox(hWnd, szVal, "ButtonTop", 0);  
		} 
	} 
 
	hr = IltmmDVDControl_get_DefaultMenuLanguage (pDVD, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
 
	} 
	hr = IltmmDVDControl_put_DefaultMenuLanguage (pDVD, 1033);  
 
	hr = IltmmDVDControl_GetNumberOfChapters (pDVD, 0, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "NumberOfChapters", 0);  
	} 
 
	hr = IltmmDVDControl_get_TotalTitleTime (pDVD, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "TotalTitleTime", 0);  
	} 
 
	hr = IltmmDVDControl_get_TitleTimecodeFlags (pDVD, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "TitleTimecodeFlags", 0);  
	} 
 
	hr = IltmmDVDControl_get_CurrentAngle (pDVD, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "CurrentAngle", 0);  
	} 
 
	hr = IltmmDVDControl_get_AnglesAvailable (pDVD, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "AnglesAvailable", 0);  
	} 
	if (lVal > 1)  
		hr = IltmmDVDControl_put_CurrentAngle (pDVD, 2);  
 
	hr = IltmmDVDControl_get_CurrentUOPS (pDVD, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "CurrentUOPS", 0);  
	} 
 
	hr = IltmmDVDControl_GetAudioLanguage (pDVD, 0, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "AudioLanguage", 0);  
	} 
 
	hr = IltmmDVDControl_get_CurrentAudioStream (pDVD, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "CurrentAudioStream", 0);  
	} 
 
	hr = IltmmDVDControl_get_AudioStreamsAvailable (pDVD, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "AudioStreamsAvailable", 0);  
	} 
 
	if (lVal > 1)  
		hr = IltmmDVDControl_put_CurrentAudioStream (pDVD, 2);  
 
	hr = IltmmDVDControl_get_CurrentTime (pDVD, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "CurrentAudioStream", 0);  
	} 
 
	hr = IltmmDVDControl_get_CurrentVolume (pDVD, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "CurrentVolume", 0);  
	} 
 
	hr = IltmmDVDControl_get_VolumesAvailable (pDVD, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "VolumesAvailable", 0);  
	} 
 
	hr = IltmmDVDControl_get_TitlesAvailable (pDVD, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "TitlesAvailable", 0);  
	} 
 
 
	hr = IltmmDVDControl_IsAudioStreamEnabled (pDVD, 0, &vEnabled);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "IsAudioStreamEnabled", 0);  
	} 
 
	hr = IltmmDVDControl_get_DefaultAudioLanguage (pDVD, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "DefaultAudioLanguage", 0);  
	} 
 
	hr = IltmmDVDControl_SelectDefaultAudioLanguage (pDVD, 1033, ltmmDVD_AUD_EXT_Captions);  
 
	hr = IltmmDVDControl_get_DVDDirectory (pDVD, &bstrVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "DVDDirectory", 0);  
	} 
 
	hr = IltmmDVDControl_get_CurrentSubpictureStream (pDVD, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "CurrentSubpictureStream", 0);  
	} 
 
	hr = IltmmDVDControl_get_SubpictureStreamsAvailable (pDVD, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "SubpictureStreamsAvailable", 0);  
	} 
 
	if (lVal > 1) 
		hr = IltmmDVDControl_put_CurrentSubpictureStream (pDVD, 1);  
 
	hr = IltmmDVDControl_get_DefaultSubpictureLanguage (pDVD, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "DefaultSubpictureLanguage", 0);  
	} 
	hr = IltmmDVDControl_SelectDefaultSubpictureLanguage (pDVD, 1033, ltmmDVD_SP_EXT_Caption_Normal);  
 
	hr = IltmmDVDControl_get_CurrentTitle (pDVD, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "CurrentTitle", 0);  
	} 
 
	hr = IltmmDVDControl_get_DefaultSubpictureLanguageExt (pDVD, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "DefaultSubpictureLanguageExt", 0);  
	} 
 
	hr = IltmmDVDControl_get_DefaultAudioLanguageExt(pDVD, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "DefaultAudioLanguageExt", 0);  
	} 
 
	hr = IltmmDVDControl_GetSubpictureLanguage (pDVD, 0, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "SubpictureLanguage", 0);  
	} 
 
	hr = IltmmDVDControl_IsSubpictureStreamEnabled (pDVD, 0, &vEnabled);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "IsSubpictureStreamEnabled", 0);  
	} 
 
	hr = IltmmDVDControl_GetDVDTextLanguageLCID (pDVD, 0, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "DVDTextLanguageLCID", 0);  
	} 
 
	hr = IltmmDVDControl_get_DVDTextNumberOfLanguages (pDVD, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "DVDTextNumberOfLanguages", 0);  
	} 
 
	hr = IltmmDVDControl_GetGPRM (pDVD, 0, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "GPRM", 0);  
	} 
	hr = IltmmDVDControl_SetGPRM (pDVD, 0, 1);  
 
	hr = IltmmDVDControl_GetDVDTextNumberOfStrings (pDVD, 0, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "DVDTextNumberOfStrings", 0);  
	} 
 
	hr = IltmmDVDControl_get_ButtonsAvailable (pDVD, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "ButtonsAvailable", 0);  
	} 
 
	hr = IltmmDVDControl_get_PlayerParentalLevel (pDVD, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "PlayerParentalLevel", 0);  
	} 
 
	hr = IltmmDVDControl_get_PlayerParentalCountry (pDVD, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "PlayerParentalCountry", 0);  
	} 
	pCountry = (BYTE*)&lVal;  
	if ((pCountry[0] != 'U') || 
		(pCountry[1] != 'S'))  
	{ 
		BYTE aRegion[2] = {0}; 
		aRegion[0] = 'U';  
		aRegion[1] = 'S';  
		lVal = *((WORD *) aRegion);  
		hr = IltmmDVDControl_SelectParentalCountry (pDVD, lVal, NULL, NULL);  
	} 
 
	hr = IltmmDVDControl_GetTitleParentalLevels (pDVD, -1, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "TitleParentalLevels", 0);  
	} 
 
	hr = IltmmDVDControl_SelectParentalLevel (pDVD, ltmmDVD_PARENTAL_LEVEL_1, NULL, NULL);  
 
	hr = IltmmDVDControl_get_CurrentDomain (pDVD, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "CurrentDomain", 0);  
	} 
 
	hr = IltmmDVDControl_get_CurrentDiscSide (pDVD, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "CurrentDiscSide", 0);  
	} 
 
	hr = IltmmDVDControl_get_CurrentChapter (pDVD, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "CurrentChapter", 0);  
	} 
 
	hr = IltmmDVDControl_GetDVDTextStringType (pDVD, 0, 0, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "DVDTextStringType", 0);  
	} 
 
	hr = IltmmDVDControl_get_SubpictureOn (pDVD, &vEnabled);  
	if (SUCCEEDED(hr))  
		MessageBox(hWnd, (vEnabled == VARIANT_TRUE) ? "On" : "Off", "SubpictureOn", 0);;  
	if (vEnabled != VARIANT_TRUE)  
		hr = IltmmDVDControl_put_SubpictureOn (pDVD, VARIANT_TRUE);  
 
	hr = IltmmDVDControl_GetSPRM (pDVD, 0, &lVal);  
	if (SUCCEEDED(hr))  
	{ 
		wsprintf(szVal, "%d", lVal);  
		MessageBox(hWnd, szVal, "SPRM", 0);  
	} 
 
	hr = IltmmDVDControl_GetDVDTextString (pDVD, 0, 0, &bstrVal);  
	if (SUCCEEDED(hr))  
		MessageBox(hWnd, OLE2T(bstrVal), "DVDTextString", 0);  
 
	hr = IltmmDVDControl_get_DVDUniqueID (pDVD, &bstrVal);  
	if (SUCCEEDED(hr))  
		MessageBox(hWnd, OLE2T(bstrVal), "DVDUniqueID", 0);  
 
	IltmmDVDControl_Release(pDVD);  
	pDVD = NULL;  
 
	return S_OK;  
} 
 
void OnDvdcontrolPause() 
{ 
	HRESULT hr;  
	hr = IltmmDVDControl_Pause (pDVD, VARIANT_TRUE);  
} 
 
void OnDvdcontrolPlaychapter() 
{ 
	HRESULT hr;  
	hr = IltmmDVDControl_PlayChapter (pDVD, 1);  
} 
 
void OnDvdcontrolPlaynextchapter() 
{ 
	HRESULT hr;  
	hr = IltmmDVDControl_PlayNextChapter (pDVD);  
 
} 
 
void OnDvdcontrolPlayprevchapter() 
{ 
	HRESULT hr;  
	hr = IltmmDVDControl_PlayPrevChapter (pDVD);  
 
} 
 
void OnDvdcontrolReplaychapter() 
{ 
	HRESULT hr;  
	hr = IltmmDVDControl_ReplayChapter (pDVD);  
 
} 
 
void OnDvdcontrolResume() 
{ 
	HRESULT hr;  
	hr = IltmmDVDControl_Resume (pDVD);    
} 
 
void OnDvdcontrolShowmenu() 
{ 
	HRESULT hr;  
	hr = IltmmDVDControl_ShowMenu (pDVD, ltmmDVD_MENU_Root);  
} 
 
void OnDvdcontrolStop() 
{ 
	HRESULT hr;  
	hr = IltmmDVDControl_Stop (pDVD);  
} 
 
void OnDvdcontrolPlayatPlayattime() 
{ 
	ltmmDVD_HMSF_TIMECODE Time;  
	HRESULT hr;  
	long *plTime;  
 
	Time.bHours = 0;  
	Time.bMinutes = 10;  
	Time.bSeconds = 0;  
	Time.bFrames = 0;  
 
	plTime = (long*)&Time;  
	hr = IltmmDVDControl_PlayAtTime (pDVD, *plTime);  
} 
 
void OnDvdcontrolPlayatPlaybackword() 
{ 
	HRESULT hr;  
	hr = IltmmDVDControl_PlayBackwards (pDVD, 5);  
} 
 
void OnDvdcontrolPlayatPlayforwards() 
{ 
	HRESULT hr;  
	hr = IltmmDVDControl_PlayForwards (pDVD, 5);  
} 
 
void OnDvdcontrolPlayatPlayatintitle() 
{ 
	ltmmDVD_HMSF_TIMECODE Time;  
	HRESULT hr;  
	long *plTime;  
 
	Time.bHours = 0;  
	Time.bMinutes = 30;  
	Time.bSeconds = 0;  
	Time.bFrames = 0;  
 
	plTime = (long*)&Time;  
	hr = IltmmDVDControl_PlayAtTimeInTitle (pDVD, 1, *plTime);  
} 
 
void OnDvdcontrolChaptersPlaychapterintitle() 
{ 
	HRESULT hr;  
 
	hr = IltmmDVDControl_PlayChapterInTitle (pDVD, 1, 3);  
} 
 
void OnDvdcontrolChaptersPlaychapterautostop() 
{ 
	HRESULT hr;  
 
	hr = IltmmDVDControl_PlayChaptersAutoStop (pDVD, 1, 2, 5);  
} 
 
void OnDvdcontrolChaptersPlaytitle() 
{ 
	HRESULT hr;  
 
	hr = IltmmDVDControl_PlayTitle (pDVD, 2);  
} 
 
void OnDvdcontrolChaptersPlayperiod() 
{ 
	HRESULT hr;  
	ltmmDVD_HMSF_TIMECODE Time1, Time2;  
	long *plTime1, *plTime2;  
 
	Time1.bHours = 0;  
	Time1.bMinutes = 30;  
	Time1.bSeconds = 0;  
	Time1.bFrames = 0;  
 
	Time2.bHours = 0;  
	Time2.bMinutes = 30;  
	Time2.bSeconds = 20;  
	Time2.bFrames = 0;  
 
	plTime1 = (long*)&Time1;  
	plTime2 = (long*)&Time2;  
 
 
	hr = IltmmDVDControl_PlayPeriodInTitleAutoStop (pDVD, 1, *plTime1, *plTime2);  
} 
 
void OnDvdcontrolReturnfromsubmenu() 
{ 
	HRESULT hr;  
	hr = IltmmDVDControl_ReturnFromSubmenu (pDVD);  
} 
 
void OnDvdcontrolStilloff() 
{ 
	HRESULT hr;  
	hr = IltmmDVDControl_StillOff (pDVD);  
} 
 
void OnDvdcontrolButtonsActivatebutton() 
{ 
	HRESULT hr;  
	hr = IltmmDVDControl_ActivateButton (pDVD);  
} 
 
void OnDvdcontrolButtonsActivateatposition() 
{ 
	HRESULT hr;  
	hr = IltmmDVDControl_ActivateAtPosition (pDVD, 10, 10);  
} 
 
void OnDvdcontrolButtonsSelectatposition() 
{ 
	HRESULT hr;  
	hr = IltmmDVDControl_SelectAtPosition (pDVD, 10, 10);  
} 
 
void OnDvdcontrolButtonsSelectandactivatebutton() 
{ 
	HRESULT hr;  
	hr = IltmmDVDControl_SelectAndActivateButton (pDVD, 1);  
} 
 
void OnDvdcontrolButtonsSelectbutton() 
{ 
	HRESULT hr;  
	long  lButton;  
 
	hr = IltmmDVDControl_GetButtonAtPosition (pDVD, 10, 10, &lButton);  
	if (FAILED(hr))  
		return;  
	hr = IltmmDVDControl_SelectButton (pDVD, lButton);  
} 
 
void OnDvdcontrolButtonsSelectrelativebutton() 
{ 
	HRESULT hr;  
	hr = IltmmDVDControl_SelectRelativeButton (pDVD, ltmmDVD_Relative_Right);  
} 
 
void OnDvdcontrolSetdvddirectory() 
{ 
	HRESULT hr;  
	hr = IltmmDVDControl_put_DVDDirectory (pDVD, (OLECHAR*)MAKE_MEDIA_PATH("")); 
} 
 
void OnDvdcontrolAcceptparentallevelchange() 
{ 
	HRESULT hr;  
	hr = IltmmDVDControl_AcceptParentalLevelChange (pDVD, VARIANT_TRUE);  
} 
 
void OnDvdcontrolNotifyparentallevelchange() 
{ 
	HRESULT hr;  
	hr = IltmmDVDControl_NotifyParentalLevelChange (pDVD, VARIANT_TRUE);  
} 
 
void OnDvdcontrolChangedvdregion(HWND hWnd)  
{ 
	HRESULT hr;  
	hr = IltmmDVDControl_ChangeDVDRegion (pDVD, (long)hWnd);  
} 
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.