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

📄 external.cpp

📁 Windows CE 下的机顶盒应用实例
💻 CPP
字号:
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//
//
// Use of this source code is subject to the terms of the Microsoft end-user
// license agreement (EULA) under which you licensed this SOFTWARE PRODUCT.
// If you did not accept the terms of the EULA, you are not authorized to use
// this source code. For a copy of the EULA, please see the LICENSE.RTF on your
// install media.
//
/*++
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
PARTICULAR PURPOSE.

Module Name:  rctlkeys.cpp

Abstract:  Implements IHostExternal; see header file for more info.

--*/

#include "stdafx.h"
#include "stbihost.h"
#include "mainwnd.h"
#include "rctlkeys.h"
#include "debugutils.h"
#if 0	// STB_OSD_CODE
#include "osdwrapper.h"
#endif
#include "external.h"

STDMETHODIMP CHostExternal::get_FullScreen(VARIANT_BOOL* pVal)
{
	if (!pVal)
	{
		ASSERT(FALSE);
		return E_POINTER;
	}

	*pVal = (m_pMainWnd->_fSafeArea ? VARIANT_FALSE : VARIANT_TRUE);

	return S_OK;
}

STDMETHODIMP CHostExternal::put_FullScreen(VARIANT_BOOL newVal)
{
	BOOL f = newVal ? FALSE : TRUE;
	f = m_pMainWnd->EnableSafeArea(f);
	return f ? S_OK : E_FAIL;
}

STDMETHODIMP
CHostExternal::get_RemoteControlKeys(/*[out, retval]*/ IDispatch** ppVal)
{
	if (!ppVal) return E_POINTER;

	if (*ppVal)
		*ppVal = NULL;

	if (!m_pUnkRCtlKeys)
	{
		m_pUnkRCtlKeys = new CComObject<CRCtlKeys>();
		if (!m_pUnkRCtlKeys) return E_OUTOFMEMORY;
		m_pUnkRCtlKeys->AddRef();
		(reinterpret_cast<CRCtlKeys*>(m_pUnkRCtlKeys))->SetInst(m_pMainWnd);
	}

	return m_pUnkRCtlKeys->QueryInterface(IID_IDispatch, (PVOID*)(ppVal));
}

STDMETHODIMP CHostExternal::get_DebugUtils(/*[out, retval]*/ IDispatch** ppVal)
{
	if (!ppVal) return E_POINTER;

	if (*ppVal)
		*ppVal = NULL;

#ifdef DEBUG
	if (!m_pUnkDbgUtils)
	{
		m_pUnkDbgUtils = new CComObject<CDebugUtils>();
		if (!m_pUnkDbgUtils) return E_OUTOFMEMORY;
		m_pUnkDbgUtils->AddRef();
	}

	return m_pUnkDbgUtils->QueryInterface(IID_IDispatch, (PVOID*)(ppVal));
#else
	return E_NOTIMPL;
#endif
}

#if 0	// STB_OSD_CODE
STDMETHODIMP CHostExternal::get_OSD(/*[out, retval]*/ IDispatch** ppVal)
{
	if (!ppVal) return E_POINTER;

	if (*ppVal)
		*ppVal = NULL;

	if (!m_pUnkOSD)
	{
		m_pUnkOSD = new CComObject<COSDWrapper>();
		if (!m_pUnkOSD) return E_OUTOFMEMORY;
		m_pUnkOSD->AddRef();
	}

	return m_pUnkOSD->QueryInterface(IID_IDispatch, (PVOID*)(ppVal));
}
#endif

⌨️ 快捷键说明

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