PDA

View Full Version : using DLL interface functions in c#


Futures_Shark
01-02-2007, 04:12 AM
I tried adding a Ninjatrader COM Client reference to a C# project and got an error message saying that the activex type library was exported from a .NET assembly and that I should reference the .NET Assembly. I have a reference to NinjaTrader.Core.dll but this doesn't seem to contain the DLL interface functions

I was able to get a DLL function to work using the following code:
[DllImport("NtDirect.dll")]
public extern static int Connected(int showMessage);

public static int _ATIConnected()
{
int ShwMsg = 0;
return Connected(ShwMsg);
}

Is this the only way to access the NtDirect.dll ATI Interface functions in C#?


The COM interface & sample code didn't work on my PC when I tried using VB6 or .NET

NinjaTrader_Ray
01-02-2007, 05:42 AM
Futures_Shark,

We will respond to this shortly once development returns.


Ray

NinjaTrader_Dierk
01-02-2007, 05:48 PM
You need to follow the docs (which does NOT reference NinjaTrader.Core.dll, see Automated Trading Interface -> COM interface) to set up the COM interface.

The docs also hold info on the DLL interface in case the COM interface does not work for you, check out the eSignal sample implementation.

Also: make sure you are on latest NT5 or NT6.

Futures_Shark
01-03-2007, 12:15 AM
I found that the file NinjaTrader.Client.dll can be added as a reference to a c# project and includes all the functions of the NtDirect.dll.

NinjaTrader_Dierk
01-03-2007, 02:17 AM
Perfect!