I'm using the JACOB (Java COM Bridge) library to call registered COM Objects from my Windows OS. It took me a while until I figured out how JACOB works and to set up everything. So my current problem is that:
ActiveXComponent comp = new ActiveXComponent("iTunes.Application");
for example works, my iTunes starts properly etc. If I want to call a self generated and registered COM Object written in C# JACOB responds the following error:
Exception in thread "main" com.jacob.com.ComFailException: Can't co-create object
That my iTunes started was an indicator for me that everything is set up right, I'm not sure why JACOB can't call my own .dll
Currently I'm using the Visual Studio 2015 on build register for COM interop function which worked pretty good in the past for me. The COM object looks as following:
[Guid("EAA4976A-45C3-4BC5-BC0B-E474F4C3C83F")]
public interface ComClass1Interface
{
}
[Guid("7BD20046-DF8C-44A6-8F6B-687FAA26FA71"), InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface ComClass1Events
{
}
[ComVisible(true)]
[Guid("0D53A3E8-E51A-49C7-944E-E72A2064F938"), ClassInterface(ClassInterfaceType.None), ComSourceInterfaces(typeof(ComClass1Events))]
[ProgId("test.Application")]
public class ComClass1 : ComClass1Interface
{
}
Is anything wrong with my C# dll or does JACOB require a certain type of structure in this dll?
Unfortunately I could not find any COM examples for JACOB.
Thanks in advance.
EDIT:
If i change my first line to:
ActiveXComponent comp = new ActiveXComponent("CLSID:{C9888A8E-8D23-4185-9D7D-A1E0B812803D}");
I'm getting following Exception:
Exception in thread "main" com.jacob.com.ComFailException: Can't find moniker
My .dll should be registered though.