I have the following class
in .NET DLL, that exports a function Initialize()
:
public class Class1
{
public static Indicator a = null;
private static int k = 0;
[DllExport( "Add", CallingConvention = CallingConvention.StdCall )]
public static int Add( int left, int right )
{
k = k + 1;
return k;
}
[DllExport( "Initialize", CallingConvention = CallingConvention.StdCall )]
public static void OnStartUp1( )
{
try
{
Thread.CurrentThread.SetApartmentState( ApartmentState.STA );
a = new Indicator();
a.Init();
}
catch ( Exception e )
{
MessageBox.Show( e.ToString() );
}
}
}
When I call this method from an external windows form .NET application, it is working and the form, created by the type Indicator, is responsive and loaded.
But when I call it from another application, called MT4 ( MetaTrader Terminal 4 metatrader4 ), it is not loading well and is not responsive and it appears like freezing.