0

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 ), it is not loading well and is not responsive and it appears like freezing.

user3666197
  • 1
  • 6
  • 50
  • 92
esalem
  • 19
  • 1
  • Is the form shown using .Show() or .ShowDialog()? If the former, the calling thread will need to be running a message loop. – Ben Jackson Dec 19 '16 at 15:11
  • I don't know if it is shown using .Show() or .ShowDialog() because I am not the one that built this library. – esalem Dec 20 '16 at 10:49
  • If you can looking to my problem my email is eyad-salem@hotmail.com – esalem Dec 20 '16 at 10:50

0 Answers0