I have a C# project that creates a COM object for use with a POS terminal. Before I give it to the customer, I want to make sure that it will work as a COM dll. The RegAsm says it works.
using System;
using System.Runtime.InteropServices;
namespace POS
{
[Guid( "0135bc5c-b248-444c-94b9-b0b4577f5a1a" )]
[InterfaceType( ComInterfaceType.InterfaceIsDual )]
[ComVisible( true )]
public interface ITwoWay
{
// The Initialize method is called to establish the communications connection...
[DispId( 1 )]
void Initialize( String IPAddress, long Port, long MaxPacketSize );
// A convenience method that allows the POS to test the Third Party’s back-end...
[DispId( 2 )]
void TestConnect();
// The Terminate method is called to indicate that the POS system is about to terminate...
[DispId( 3 )]
void Terminate();
// All interface calls made during a transaction send the same record format with specific reply fields ...
[DispId( 4 )]
void TransactionCall( String viPOSMsg, ref String InterceptArray );
}
}
The actual entry points are defined in class TwoWay
using System.Runtime.InteropServices;
using System.EnterpriseServices;
namespace POS
{
[Guid( "0135bc5c-b248-444c-94b9-b0b4577f5a1b" )]
[ComDefaultInterface(typeof(ITwoWay))]
[ClassInterface( ClassInterfaceType.None )]
[ComVisible( true )]
public class TwoWay : ITwoWay
...
[ComVisible( true )]
public void Initialize( string iPAddress, long port, long maxPacketSize )
...
I have a C# project that creates a COM object for use with a POS terminal. Before I give it to the customer, I want to make sure that it will work as a COM dll. The RegAsm says it works.
using System;
using System.Runtime.InteropServices;
namespace POS
{
[Guid( "0135bc5c-b248-444c-94b9-b0b4577f5a1a" )]
[InterfaceType( ComInterfaceType.InterfaceIsDual )]
[ComVisible( true )]
public interface ITwoWay
{
// The Initialize method is called to establish the communications connection...
[DispId( 1 )]
void Initialize( String IPAddress, long Port, long MaxPacketSize );
// A convenience method that allows the POS to test the Third Party’s back-end...
[DispId( 2 )]
void TestConnect();
// The Terminate method is called to indicate that the POS system is about to terminate...
[DispId( 3 )]
void Terminate();
// All interface calls made during a transaction send the same record format with specific reply fields ...
[DispId( 4 )]
void TransactionCall( String viPOSMsg, ref String InterceptArray );
}
}
The actual entry points are defined in class TwoWay
using System.Runtime.InteropServices;
using System.EnterpriseServices;
namespace POS
{
[Guid( "0135bc5c-b248-444c-94b9-b0b4577f5a1b" )]
[ComDefaultInterface(typeof(ITwoWay))]
[ClassInterface( ClassInterfaceType.None )]
[ComVisible( true )]
public class TwoWay : ITwoWay
...
[ComVisible( true )]
public void Initialize( string iPAddress, long port, long maxPacketSize )
...
I had thought that I could import the .tlb into another .net project and test it that way but when I add my COM project as a COM reference VS rejects it because it was created as .NET dll.
I tried to create a vb script to run CreateObject but that errors on permissions. I attempted to set up the I_USER account, etc but I couldn't get that going.
The registry shows an entry with the right name and the class id is set to the correct guid. But still, I want to load it and run it through the COM interface.
How does one verify that a COM .dll is actually a COM .dll? As old as this is, there must be a way.