If using .NET 2.0, try this:
///////C# project is compiled as TestCSharpCOM.dll:
///////
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
namespace TestCSharpCOM
{
[Guid("FE896CA2-3EBB-45c0-A9F3-595D1E81A41E")]
public interface ICSharpCOM
{
[DispId(1)]
void SayHello();
};
[Guid("C4C41C12-6725-4f7a-91B4-014E9DABFC43"),
ClassInterface(ClassInterfaceType.None)]
public class CSharpCOM : ICSharpCOM
{
public CSharpCOM()
{
}
public void SayHello()
{
MessageBox.Show("Hello From CSharp");
}
};
}
run regasm on above dll, then:
VC++ 6 project:
// TestConsole.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#import "TestCSharpCOM.tlb" no_namespace raw_dispinterfaces
int main(int argc, char* argv[])
{
CoInitialize(NULL);
ICSharpCOMPtr p = NULL;
p.CreateInstance(__uuidof(CSharpCOM));
p->SayHello();
CoUninitialize();
return 0;
}
Good luck
Brian M
Keller TX
matt.m.jacobsen@gmail.com - 10 Nov 2006 09:00 GMT
Hi,
Erm, Which Stdafx.h? Are you building this yourself?
Cheers,
Matt
Brian M schrieb:
> If using .NET 2.0, try this:
>
[quoted text clipped - 51 lines]
> Brian M
> Keller TX
matt.m.jacobsen@gmail.com - 10 Nov 2006 09:00 GMT
Hi,
Erm, Which Stdafx.h? Are you building this yourself?
Cheers,
Matt
Brian M schrieb:
> If using .NET 2.0, try this:
>
[quoted text clipped - 51 lines]
> Brian M
> Keller TX