J
Jeff0803
Guest
I'm trying to make program by myself following instruction linked here.
I completed making C# .NET COM and trying to make C++ side code.
At step4 in the C++ side code(Steps to create an Unmanaged C++ application to call a .NET Managed C# COM), if compile with "#import "C:\CSharpSample\MyInterop\MyInterop\bin\Release\com.MyInterop.tlb" named_guids raw_interfaces_only", com.myinterop.tlh is generated like following.
#pragma once
#pragma pack(push, 8)
#include <comdef.h>
namespace MyInterop {
//
// Forward references and typedefs
//
struct __declspec(uuid("b1abdad3-e600-4357-a3a1-767b839e66e7"))
/* LIBID */ __MyInterop;
//
// Named GUID constants initializations
//
extern "C" const GUID __declspec(selectany) LIBID_MyInterop =
{0xb1abdad3,0xe600,0x4357,{0xa3,0xa1,0x76,0x7b,0x83,0x9e,0x66,0xe7}};
} // namespace MyInterop
#pragma pack(pop)
And added C++ codes like following.
#include "stdafx.h"
#import "C:\CSharpSample\MyInterop\MyInterop\bin\Release\com.MyInterop.tlb" named_guids raw_interfaces_only
int _tmain(int argc, _TCHAR* argv[])
{
CoInitialize(NULL);
MyInterop::IMyDotNetInterfacePtr pDotNetCOMPtr;
HRESULT hRes = pDotNetCOMPtr.CreateInstance(MyInterop::CLSID_MyDotNetClass);
if (hRes == S_OK)
{
pDotNetCOMPtr->ShowDialog ();
}
CoUninitialize ();
return 0;
}
If compile this, error occurs because MyInterop does not expose IMyDotNetInterfacePtr.
How could I get correct namespace and interface name?
Can anybody give me some advice?
Thanks in advance,
Continue reading...
I completed making C# .NET COM and trying to make C++ side code.
At step4 in the C++ side code(Steps to create an Unmanaged C++ application to call a .NET Managed C# COM), if compile with "#import "C:\CSharpSample\MyInterop\MyInterop\bin\Release\com.MyInterop.tlb" named_guids raw_interfaces_only", com.myinterop.tlh is generated like following.
#pragma once
#pragma pack(push, 8)
#include <comdef.h>
namespace MyInterop {
//
// Forward references and typedefs
//
struct __declspec(uuid("b1abdad3-e600-4357-a3a1-767b839e66e7"))
/* LIBID */ __MyInterop;
//
// Named GUID constants initializations
//
extern "C" const GUID __declspec(selectany) LIBID_MyInterop =
{0xb1abdad3,0xe600,0x4357,{0xa3,0xa1,0x76,0x7b,0x83,0x9e,0x66,0xe7}};
} // namespace MyInterop
#pragma pack(pop)
And added C++ codes like following.
#include "stdafx.h"
#import "C:\CSharpSample\MyInterop\MyInterop\bin\Release\com.MyInterop.tlb" named_guids raw_interfaces_only
int _tmain(int argc, _TCHAR* argv[])
{
CoInitialize(NULL);
MyInterop::IMyDotNetInterfacePtr pDotNetCOMPtr;
HRESULT hRes = pDotNetCOMPtr.CreateInstance(MyInterop::CLSID_MyDotNetClass);
if (hRes == S_OK)
{
pDotNetCOMPtr->ShowDialog ();
}
CoUninitialize ();
return 0;
}
If compile this, error occurs because MyInterop does not expose IMyDotNetInterfacePtr.
How could I get correct namespace and interface name?
Can anybody give me some advice?
Thanks in advance,
Continue reading...