Example #1
0
/*----------------------------------------------------------------------------------------------
	Create a LgTsEnumFORMATETC object.

	@param ppenum Address of a pointer for returning the newly created LgTsEnumFORMATETC COM
					object.
----------------------------------------------------------------------------------------------*/
void LgTsEnumFORMATETC::Create(IEnumFORMATETC ** ppenum)
{
	AssertPtr(ppenum);

	ComSmartPtr<LgTsEnumFORMATETC> qtsenum;
	qtsenum.Attach(NewObj LgTsEnumFORMATETC);
	*ppenum = qtsenum.Detach();
}
void LgUnicodeCollater::CreateCom(IUnknown *punkCtl, REFIID riid, void ** ppv)
{
	AssertPtr(ppv);
	Assert(!*ppv);
	if (punkCtl)
		ThrowHr(WarnHr(CLASS_E_NOAGGREGATION));
	ComSmartPtr<LgUnicodeCollater> qunicoll;
	qunicoll.Attach(NewObj LgUnicodeCollater());		// ref count initialy 1
	CheckHr(qunicoll->QueryInterface(riid, ppv));
}
Example #3
0
void RomRenderEngine::CreateCom(IUnknown *punkCtl, REFIID riid, void ** ppv)
{
	AssertPtr(ppv);
	Assert(!*ppv);
	if (punkCtl)
		ThrowHr(WarnHr(CLASS_E_NOAGGREGATION));

	ComSmartPtr<RomRenderEngine> qrre;
	qrre.Attach(NewObj RomRenderEngine());		// ref count initialy 1
	CheckHr(qrre->QueryInterface(riid, ppv));
}
Example #4
0
/*----------------------------------------------------------------------------------------------
	This static method creates a new LgTsDataObject object.
----------------------------------------------------------------------------------------------*/
void LgTsDataObject::CreateCom(IUnknown *punkCtl, REFIID riid, void ** ppv)
{
	AssertPtr(ppv);
	Assert(!*ppv);
	if (punkCtl)
		ThrowHr(WarnHr(CLASS_E_NOAGGREGATION));

	ComSmartPtr<LgTsDataObject> qtsdo;
	qtsdo.Attach(NewObj LgTsDataObject); 		// ref count initialy 1
	CheckHr(qtsdo->QueryInterface(riid, ppv));
}
Example #5
0
void SampleInterface::CreateCom(IUnknown *punkCtl, REFIID riid, void ** ppv)
{
	AssertPtr(ppv);
	Assert(!*ppv);
	if (punkCtl)
		ThrowHr(WarnHr(CLASS_E_NOAGGREGATION));

	ComSmartPtr<SampleInterface> qxsi;
	qxsi.Attach(NewObj SampleInterface());		// ref count initialy 1
	CheckHr(qxsi->QueryInterface(riid, ppv));
}
Example #6
0
void LgIcuConverterEnumerator::CreateCom(IUnknown *punkCtl, REFIID riid, void ** ppv)
{
	AssertPtr(ppv);
	Assert(!*ppv);
	if (punkCtl)
		ThrowHr(WarnHr(CLASS_E_NOAGGREGATION));

	ComSmartPtr<LgIcuConverterEnumerator> qlcpe;
	qlcpe.Attach(NewObj LgIcuConverterEnumerator());		// ref count initialy 1
	CheckHr(qlcpe->QueryInterface(riid, ppv));
}
Example #7
0
void AfFwTool::CreateCom(IUnknown *punkCtl, REFIID riid, void ** ppv)
{
	AssertPtr(ppv);
	Assert(!*ppv);
	if (punkCtl)
		ThrowHr(WarnHr(CLASS_E_NOAGGREGATION));

	ComSmartPtr<AfFwTool> qaft;
	qaft.Attach(NewObj AfFwTool());		// ref count initialy 1
	CheckHr(qaft->QueryInterface(riid, ppv));
}
Example #8
0
/*----------------------------------------------------------------------------------------------
	Static method to create a new FileStream object, opening the specified file in the
	specified mode.
		@param pszFile Name (or path) of the desired file (LPCOLESTR)
		@param grfstgm Combination of flags kfstgmXxxx from enum in FileStrm.h
		@return The associated IStream interface pointer if successful (third parameter).
----------------------------------------------------------------------------------------------*/
void FileStream::Create(LPCOLESTR pszFile, int grfstgm, IStream ** ppstrm)
{
	AssertPsz(pszFile);
	AssertPtr(ppstrm);
	Assert(!*ppstrm);

	ComSmartPtr<FileStream> qfist;
	qfist.Attach(NewObj FileStream);
	qfist->Init(pszFile, grfstgm);
	*ppstrm = qfist.Detach();
}
Example #9
0
void VwInvertedRootBox::CreateCom(IUnknown *punkCtl, REFIID riid, void ** ppv)
{
	AssertPtr(ppv);
	Assert(!*ppv);
	if (punkCtl)
		ThrowHr(WarnHr(CLASS_E_NOAGGREGATION));

	ComSmartPtr<VwInvertedRootBox> qrootb;
	qrootb.Attach(NewObj VwInvertedRootBox());		// ref count initialy 1
	CheckHr(qrootb->QueryInterface(riid, ppv));
}
Example #10
0
/*----------------------------------------------------------------------------------------------
	Static method to create an instance of FwCppStylesDlg.
----------------------------------------------------------------------------------------------*/
void FwCppStylesDlg::CreateCom(IUnknown *punkCtl, REFIID riid, void ** ppv)
{
    AssertPtr(ppv);
    Assert(!*ppv);
    if (punkCtl)
        ThrowHr(WarnHr(CLASS_E_NOAGGREGATION));

    ComSmartPtr<FwCppStylesDlg> qzfwst;
    qzfwst.Attach(NewObj FwCppStylesDlg());	// ref count initially 1
    CheckHr(qzfwst->QueryInterface(riid, ppv));
}
Example #11
0
void LgInputMethodEditor::CreateCom(IUnknown *punkCtl, REFIID riid, void ** ppv)
{
	AssertPtr(ppv);
	Assert(!*ppv);
	if (punkCtl)
		ThrowHr(WarnHr(CLASS_E_NOAGGREGATION));

	ComSmartPtr<LgInputMethodEditor> qime;
	qime.Attach(NewObj LgInputMethodEditor());		// ref count initialy 1
	CheckHr(qime->QueryInterface(riid, ppv));
}
Example #12
0
/*----------------------------------------------------------------------------------------------
	Static method to create a new ResourceStream object, to open the specified resource for
	reading, and to return the associated IStream interface pointer if successful.
		@param hmod Handle of the module containing the resource
		@param pszType Pointer to resource type
		@param rid Integer identifier of the resource
----------------------------------------------------------------------------------------------*/
void ResourceStream::Create(HMODULE hmod, const achar * pszType,
	int rid, IStream ** ppstrm)
{
	AssertPtr(ppstrm);
	Assert(!*ppstrm);

	ComSmartPtr<ResourceStream> qrest;
	qrest.Attach(NewObj ResourceStream);
	qrest->Init(hmod, pszType, rid);
	*ppstrm = qrest.Detach();
}
Example #13
0
//:>********************************************************************************************
//:>	DbColSpec - IUnknown methods
//:>********************************************************************************************
void DbColSpec::CreateCom(IUnknown *punkCtl, REFIID riid, void ** ppv)
{
	AssertPtr(ppv);
	Assert(!*ppv);
	if (punkCtl)
	{
		ThrowHr(WarnHr(CLASS_E_NOAGGREGATION));
	}
	ComSmartPtr<DbColSpec> qzdcs;
	qzdcs.Attach(NewObj DbColSpec());	// ref count initially 1
	CheckHr(qzdcs->QueryInterface(riid, ppv));
}
Example #14
0
void DebugReport::CreateCom(IUnknown *punkCtl, REFIID riid, void ** ppv)
{
	AssertPtr(ppv);
	Assert(!*ppv);
	if (punkCtl)
	{
		ThrowHr(WarnHr(CLASS_E_NOAGGREGATION));
	}
	ComSmartPtr<DebugReport> qdbr;
	// Ref count initially 1
	qdbr.Attach(NewObj DebugReport());
	CheckHr(qdbr->QueryInterface(riid, ppv));
}
Example #15
0
void ActionHandler::CreateCom(IUnknown *punkCtl, REFIID riid, void ** ppv)
{
	AssertPtr(ppv);
	Assert(!*ppv);
	if (punkCtl)
	{
		ThrowHr(WarnHr(CLASS_E_NOAGGREGATION));
	}
	ComSmartPtr<ActionHandler> qzacth;
	// Ref count initially 1
	qzacth.Attach(NewObj ActionHandler());
	CheckHr(qzacth->QueryInterface(riid, ppv));
}
Example #16
0
void LgIcuResourceBundle::CreateCom(IUnknown *punkCtl, REFIID riid, void ** ppv)
{
	AssertPtr(ppv);
	Assert(!*ppv);
	if (punkCtl)
		ThrowHr(WarnHr(CLASS_E_NOAGGREGATION));

	ComSmartPtr<LgIcuResourceBundle> qlcpe;
	StrUtil::InitIcuDataDir();

	UErrorCode uerr = U_ZERO_ERROR;
	ResourceBundle rbt(NULL, Locale("en"), uerr);
	if (U_FAILURE(uerr))
		ThrowHr(E_FAIL);
	qlcpe.Attach(NewObj LgIcuResourceBundle(rbt));		// ref count initialy 1
	CheckHr(qlcpe->QueryInterface(riid, ppv));
}
Example #17
0
/*----------------------------------------------------------------------------------------------
	Create a new stream object that references the same bytes as the original stream but
	provides a separate seek pointer to those bytes.
----------------------------------------------------------------------------------------------*/
STDMETHODIMP ResourceStream::Clone(IStream ** ppstm)
{
	BEGIN_COM_METHOD;
	// Validate the pointer
	ChkComOutPtr(ppstm);

	// Create a new object
	ComSmartPtr<ResourceStream> qrest;
	qrest.Attach(NewObj ResourceStream);

	// Initialize the new object
	qrest->m_cbData = m_cbData;
	qrest->m_prgbData = m_prgbData;
	qrest->m_pbCur = m_pbCur;

	*ppstm = qrest.Detach();
	END_COM_METHOD(g_fact, IID_IStream);
}
// called once on initialization
void SensorManager::CreateListOfAvailableSensors()
{
    // gets the count of sensors from Kinect for Windows API
    int iCount = 0;
    HRESULT hr = NuiGetSensorCount( &iCount );
    if( FAILED(hr) )
    {
        return;
    }

    // if there are no sensors, create a temporary one
    if( 0 == iCount )
    {
        // when the first sensor is connected, it will be added
        // with the correct id
        if( m_kinectSensors.size() == 0 )
        {
            AddSensorToList( m_wcTempPortID );
        }
    }

    // continue with the known sensors to the list
    for (int i = 0; i < iCount; ++i)
    {
        INuiSensor* pNui = nullptr;
        ComSmartPtr<INuiSensor> pNuiPtr;
        if( SUCCEEDED( NuiCreateSensorByIndex(i, &pNui) ) )
        {
            pNuiPtr.Attach(pNui); // Setting up smart pointer for sensor.

            const WCHAR* wcPortID = pNuiPtr->NuiDeviceConnectionId();  // contains the connections string for the device
                                                                    // plugged into a specific USB port. 
                                                                    // removing the sensor and using a different port will have
                                                                    // a different ID.
            AddSensorToList( wcPortID );
        }
    }

}