I know that only some system provided COM components are available or WinRT component. Now, I'm creating a new WinRT component and would like to call my in-house COM component. This in-house component is just a test, pretty simple, an interface with a single
method to return a string. However, in my WinRT component, "Class not registered" error returned all the time whenever to get the instance of that component. The question is, is it available to call COM component from WinRT component? Thanks.
Here is interface definition of COM component. (a in-process DLL)
interface __declspec(uuid("C57A8CA5-1C97-447e-9176-BAB222D8EDCB"))
IGardenInfo : public IUnknown
{
virtual HRESULT __stdcall GardenName(BSTR *strName) = 0;
};
In my WinRT component, codes to create instance of that COM component
namespace mycomp
{
// delegates
// Activatable class.
public ref class LangSample sealed
{
IGardenInfo* m_pGI;
IGarden *m_pG;
Platform::String^ m_GardenName;
Platform::String^ m_GardenTitle;
int nRetCode;
public:
LangSample()
{
nRetCode = 0;
HRESULT hRes = S_OK;
hRes = ::CoCreateInstance(CLSID_Garden, 0, 0, __uuidof(IGardenInfo), (void**)&m_pGI);
if (hRes != S_OK)
{
m_GardenName = "Win32 Garden Name failed, allocated in WINRT";
nRetCode = hRes;
}
else
{
BSTR str = SysAllocString(L"GardenName-WinRT");
m_pGI->GardenName(&str);
m_GardenName = ref new Platform::String(str);
}
hRes = ::CoCreateInstance(CLSID_Garden, 0, 0, __uuidof(IGarden), (void**)&m_pG);
if (hRes != S_OK)
{
m_GardenTitle = "Win32 Garden Info failed, allocated in WINRT";
}
else
{
BSTR str = SysAllocString(L"GardenTitle-WinRT");
m_pG->GetInfo(&str);
m_GardenTitle = ref new Platform::String(str);
}
}