Hi All,
I am trying to call managed C++ code from COM component and at the same time trying to call that COM component from VB.Net.
Tried so many examples but none of them working.
Can anybody help me with some pointers.
*****Managed C++ code Start************
namespace PrjManagedCpp {
public ref class Class1
{
static void Display();
};
}
*****Managed C++ code End************
Thanks in Advance,
Sanjeev
What I have tried:
1. Created Managed C++ Code :
namespace PrjManagedCpp {
public ref class Class1
{
static void Display();
};
2. Created tlb file for Managed C++ code.
3. Wrote partial COM component using tlb file.
#include "stdafx.h"
#include "CallCpp.h"
#import "D:\C++ Projects\PrjManagedCpp\Debug\PrjManagedCpp.tlb"
STDMETHODIMP CCallCpp::CallDisplayMethod(void)
{
HRESULT hRes = S_OK;
CoInitialize(NULL);
//Wanted to write some code here so that it will call method from managed C++
CoUninitialize();
return S_OK;
}
4. Created a button on VB.Net, and on this button click I would like to call COM's method which internally will call managed code's method