Download MetaTrader 5

DLL import problem

To add comments, please log in or register
charly king her
969
charly king her  

[CONDITIONS] 

 

1) Compilation is perfect without ERROR or WARNING.

2) TERMINAL Setting: ALLOW DLL

3) MQL5 Setting: ALLOW DLL 

4) I use MT5 build 228 

 

[PROBLEM]

When attach to chart, terminal gives error and says that "DLL loading is NOT allow".

 

 

Anybody have a clue to the problem.   

Rashid Umarov
Admin
12399
Rashid Umarov  

Is it a script? Have you ticked "Allow dll imports"?



Try script below from section Scope Resolution Operation (::)


//+------------------------------------------------------------------+
//|                                                 CheckContext.mq5 |
//|                      Copyright © 2009, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

#property script_show_inputs
#import"kernel32.dll"
int GetLastError(void);
#import
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
class CCheckContext
  {
   int               m_id;
public:
                     CCheckContext() { m_id=1234; }
protected:
   int         GetLastError() { return(m_id); }
  };
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
class CCheckContext2 : public CCheckContext
  {
   int               m_id2;
public:
                     CCheckContext2() { m_id2=5678; }
   void              Print();
protected:
   int         GetLastError() { return(m_id2); }
  };
//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
void CCheckContext2::Print()
  {
   ::Print("Terminal GetLastError",::GetLastError());
   ::Print("kernel32 GetLastError",kernel32::GetLastError());
   ::Print("parent GetLastError",CCheckContext::GetLastError());
   ::Print("our GetLastError",GetLastError());
  }
//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
//---
   CCheckContext2 test;
   test.Print();

   struct SessionTime
     {
      string sessionName;
      int    startHour;
      int    startMinutes;
      int    endHour;
      int    endMinutes;
     };
    
   SessionTime st;  
   st.sessionName="Asian";
   st.startHour=0;
   st.startMinutes=0;
   st.endHour=9;
   st.endMinutes=0;
   Print(st.sessionName,st.startHour,st.startMinutes,st.endHour,st.endMinutes);
  }
//+------------------------------------------------------------------+

Paul
784
Paul  
Rosh :

Is it a script? Have you ticked "Allow dll imports"?



Try script below from section Scope Resolution Operation (::)


Scripts including the one above won't load DLLs in debug mode.

 

 

Ilyas
1205
Ilyas  
phampton :

Scripts including the one above won't load DLLs in debug mode.


Thank you for your message. Bug fixed.
To add comments, please log in or register