Tiles/TileProviders in my MFC Application

I have issues with my code below: The problem occurs at the point of assignment:
_tiles = m_map.get_Tiles();
Can anybody assist me to know what may be wrong?

#pragma region PopulateProvidersCombo
	ITilesPtr _tiles;
	_tiles.CreateInstance(__uuidof(Tiles));
	_tiles = m_map.get_Tiles();
	ITileProvidersPtr _TileProviders;
	_TileProviders.CreateInstance(__uuidof(TileProviders));
	_TileProviders = _tiles->Providers;
	CMFCRibbonComboBox* pComboBox = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, m_pWnd->m_wndRibbonBar.FindByID(ID_TOOLS_TILEPROVIDER));
	pComboBox->RemoveAllItems();
	for (int i = 0; i < _TileProviders->Count; i++)
	{
		pComboBox->AddItem((_bstr_t)_TileProviders->GetName(i));
	}
#pragma endregion

I have not seen any post that addressed the issue. Any assistance is appreciated.
Thank you.

I have solution to this question as follows:
#pragma region PopulateProvidersCombo

	LPDISPATCH m_tiles = m_map.get_Tiles();
    struct ITiles* _tiles = nullptr;
    m_tiles->QueryInterface(IID_ITiles, (void**)&_tiles);

	ITileProvidersPtr m_TileProviders;
	m_TileProviders.CreateInstance(__uuidof(TileProviders));
	m_TileProviders = _tiles->Providers;
	CMFCRibbonComboBox* pComboBox = DYNAMIC_DOWNCAST(CMFCRibbonComboBox, m_pWnd->m_wndRibbonBar.FindByID(ID_TOOLS_TILEPROVIDER));
	pComboBox->RemoveAllItems();
    // add ProviderNone
    // and then the legacy providers
	for (int i = 0; i < m_TileProviders->Count; i++)
	{
		pComboBox->AddItem((_bstr_t)m_TileProviders->GetName(i));
	}
	m_tiles->Release();
    // lastly add CustomProvider
 //   pComboBox->SelectItem(
   
#pragma endregion

I will appreciate a better approach.
Note: my application uses CMFCRibbonBar UI.

This topic was automatically closed 42 days after the last reply. New replies are no longer allowed.