help example function must have body why ?

 

hi guys  i try to run a example in EA

https://docs.mql4.com/check/isdllsallowed

#property strict
#import "user32.dll"
#import

int     MessageBoxA(int hWnd, string szText, string szCaption,int nType);

// Global Variables

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int OnInit()
  {

   return(0);
  }

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
int deinit()
  {
   return(0);
  }

//+------------------------------------------------------------------+
//|            expert start function                                                     |
//+------------------------------------------------------------------+
int start()
  {
  
   if(IsDllsAllowed()==false) 
    { 
     Print("DLL call is not allowed. Experts cannot run."); 
     return(0); 
    } 
   MessageBoxA(0,"an message","Message",MB_OK);
   return(0);



  }
//+------------------------------------------------------------------+

but return when i compile 

error  'MessageBoxA' - function must have a body    MeMTest.mq4    19    9

why ?? o_O

i have  able Autotrade  and in option i able  allow DLL imports

but nothing  anyone have some idea ? thankz

IsDllsAllowed - Checkup - MQL4 Reference
IsDllsAllowed - Checkup - MQL4 Reference
  • docs.mql4.com
IsDllsAllowed - Checkup - MQL4 Reference
 
faustf:

hi guys  i try to run a example in EA

https://docs.mql4.com/check/isdllsallowed

but return when i compile 

error  'MessageBoxA' - function must have a body    MeMTest.mq4    19    9

why ?? o_O

i have  able Autotrade  and in option i able  allow DLL imports

but nothing  anyone have some idea ? thankz

Hello .

You need to declare it inside the import

#import "shell32.dll" 
int ShellExecuteW(int hwnd,string Operation,string File,string Parameters,string Directory,int ShowCmd); 
#import
 

Of course a function must have a body otherwise what is the point of the function?

What do you expect to happen when you call this function?

int     MessageBoxA(int hWnd, string szText, string szCaption,int nType);

This will at least return something

int     MessageBoxA(int hWnd, string szText, string szCaption,int nType)
  {
   int x=0;
   //Calculate the value of x??
   return(x);
  }
 
aaaaaaaaaaaaaaaa   thankz
 
You can not use any xxxxxxxxA. Strings have been Unicode since build 600 and Higher - MQL4 Articles 2014.02.03