⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 complayer.cpp

📁 用vc写的一个插件例子
💻 CPP
字号:
// ComPlayer.cpp : Implementation of CComPlayer
#include "stdafx.h"
#include "HBPlayCom.h"
#include "ComPlayer.h"

#include "HBPlaySDK.h"
/////////////////////////////////////////////////////////////////////////////
// CComPlayer

STDMETHODIMP CComPlayer::InterfaceSupportsErrorInfo(REFIID riid)
{
	static const IID* arr[] = 
	{
		&IID_IComPlayer
	};
	for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++)
	{
		if (InlineIsEqualGUID(*arr[i],riid))
			return S_OK;
	}
	return S_FALSE;
}

STDMETHODIMP CComPlayer::Free()
{
	// TODO: Add your implementation code here

	return S_OK;
}

STDMETHODIMP CComPlayer::Initial(long hWnd)
{
	// TODO: Add your implementation code here

	return S_OK;
}


STDMETHODIMP CComPlayer::CloseFile(long hHandle)
{
	// TODO: Add your implementation code here
	HB_PLAY_CloseFile(hHandle);

	return S_OK;
}

STDMETHODIMP CComPlayer::SetCallBack(long hHandle, long pCallBack)
{
	// TODO: Add your implementation code here

	return S_OK;
}

STDMETHODIMP CComPlayer::OpenStream(long *phHandle, long *pFileHeadBuf, long lSize)
{
	// TODO: Add your implementation code here
	*phHandle = HB_PLAY_OpenStreamEx((char *)pFileHeadBuf, lSize, 2);

	return S_OK;
}

STDMETHODIMP CComPlayer::CloseStream(long hHandle)
{
	HB_PLAY_CloseStream(hHandle);

	return S_OK;
}

STDMETHODIMP CComPlayer::OpenFile(long *phHandle, BSTR sFileName)
{
	*phHandle = HB_PLAY_OpenFileEx((char *)sFileName);

	return S_OK;
}

STDMETHODIMP CComPlayer::InputData(long hHandle, long *pBuf, long lSize)
{
	return HB_PLAY_InputData(hHandle, (char *)pBuf, lSize, 0);

	//return S_OK;
}

STDMETHODIMP CComPlayer::SetPlayDirection(long lDirection)
{
	// TODO: Add your implementation code here

	return S_OK;
}

STDMETHODIMP CComPlayer::SetPlayPos(long hHandle, long lPos)
{
	float	fPos = (float) (lPos/100.);

	HB_PLAY_SetPlayPos(hHandle, fPos);
	return S_OK;
}

STDMETHODIMP CComPlayer::GetPlayPos(long hHandle, long *pPos)
{
	float fPos = HB_PLAY_GetPlayPos(hHandle);
	*pPos = (long)(100.*fPos);
	return S_OK;
}

STDMETHODIMP CComPlayer::Fast(long hHandle)
{
	HB_PLAY_Fast(hHandle);

	return S_OK;
}

STDMETHODIMP CComPlayer::Slow(long hHandle)
{
	HB_PLAY_Slow(hHandle);

	return S_OK;
}

STDMETHODIMP CComPlayer::SetFileEndMsgWnd(long hHandle, long hWnd, long lMsg)
{
	HB_PLAY_SetFileEndMsg(hHandle, (HWND)hWnd, lMsg);

	return S_OK;
}

STDMETHODIMP CComPlayer::Play(long hHandle, long hWnd)
{
	HB_PLAY_Play(hHandle, (HWND)hWnd);

	return S_OK;
}

STDMETHODIMP CComPlayer::Stop(long hHandle)
{
	HB_PLAY_Stop(hHandle);

	return S_OK;
}

STDMETHODIMP CComPlayer::Pause(long hHandle, long lPause)
{
	if (lPause)
		HB_PLAY_Pause(hHandle);
	else
		HB_PLAY_Play(hHandle);

	return S_OK;
}

STDMETHODIMP CComPlayer::PlaySound(long hHandle)
{
	HB_PLAY_OpenSound(hHandle);

	return S_OK;
}

STDMETHODIMP CComPlayer::StopSound(long hHandle)
{
	HB_PLAY_CloseSound(hHandle);

	return S_OK;
}

STDMETHODIMP CComPlayer::RefreshSurface(long hHandle)
{
	

	return S_OK;
}

STDMETHODIMP CComPlayer::CapPic(long hHandle, BSTR sFileName)
{
	HB_PLAY_SnapShot(hHandle, (char *)sFileName);

	return S_OK;
}

STDMETHODIMP CComPlayer::SetVolume(long hHandle, long lVolume)
{
	HB_PLAY_SetVolume(hHandle, (WORD)lVolume);

	return S_OK;
}

STDMETHODIMP CComPlayer::GetVolume(long hHandle, long *pVolume)
{
	*pVolume = (long )HB_PLAY_GetVolume(hHandle);

	return S_OK;
}

STDMETHODIMP CComPlayer::SetColor(long hHandle, long lBrightness, long lContrast, long lSaturation, long lHue)
{
	HB_PLAY_SetVideoColor(hHandle, lBrightness, lContrast, lSaturation, lHue);

	return S_OK;
}

STDMETHODIMP CComPlayer::GetColor(long hHandle, long *pBrightness, long *pContrast, long *pSaturation, long *pHue)
{
	HB_PLAY_GetVideoColor(hHandle, pBrightness, pContrast, pSaturation, pHue);

	return S_OK;
}

STDMETHODIMP CComPlayer::GetVersion(long *lVer)
{
	*lVer = 0x10001000;

	return S_OK;
}

STDMETHODIMP CComPlayer::QueryFunction(BSTR sFunctionName, long *lCanUse)
{
	*lCanUse = 0;

	return S_OK;
}

STDMETHODIMP CComPlayer::SetParameter(long hHandle, long lType, long lPara1, long Para2)
{
	// TODO: Add your implementation code here

	return S_OK;
}

STDMETHODIMP CComPlayer::GetParameter(long hHandle, long lType, long *pPara1, long *pPara2)
{
	// TODO: Add your implementation code here

	return S_OK;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -