www.pudn.com > STBIHOST.rar > external.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();
if (!m_pUnkRCtlKeys) return E_OUTOFMEMORY;
m_pUnkRCtlKeys->AddRef();
(reinterpret_cast(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();
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();
if (!m_pUnkOSD) return E_OUTOFMEMORY;
m_pUnkOSD->AddRef();
}
return m_pUnkOSD->QueryInterface(IID_IDispatch, (PVOID*)(ppVal));
}
#endif