Download MetaTrader 5

Wininet.dll for MAC

To add comments, please log in or register
Richard Read
336
Richard Read  

Hi there,

 

I don't have a MAC, but want to know if it is at all possible Wininet functions on a MAC?

 

I have an indicator, that I want to use to check if an account is active/inactive via a URL, but WebRequest() is not available for indicators.

 

I have the following code running successfully for a script, but I'm pretty sure a MAC would not be able to make use of it?

 

 

#import  "Wininet.dll"
int InternetOpenW(string,int,string,string,int);
int InternetConnectW(int,string,int,string,string,int,int,int);
int InternetOpenUrlW(int,string,string,int,int,int);
int InternetReadFile(int,uchar  &arr[],int,int  &arr[]);
int InternetCloseHandle(int);
#import

int OnInit()
  {  
int HttpOpen=InternetOpenW(" ",0," "," ",0);
   int HttpConnect = InternetConnectW(HttpOpen, "", 80, "", "", 3, 0, 1);
   int HttpRequest = InternetOpenUrlW(HttpOpen, url+Username+"&pass="+Password, NULL, 0, 0, 0);

   int read[1];
   uchar  Buffer[];
   ArrayResize(Buffer,100+1);
   InternetReadFile(HttpRequest,Buffer,100,read);
   string strThisRead=CharArrayToString(Buffer,0,read[0],CP_UTF8);
   if(HttpRequest>0) InternetCloseHandle(HttpRequest);
   if(HttpConnect>0) InternetCloseHandle(HttpConnect);
   if(HttpOpen>0) InternetCloseHandle(HttpOpen);
   if(strThisRead!="active")
     {
      Alert("Invalid account, please contact Support");
      return(INIT_FAILED);
     }
   return(INIT_SUCCEEDED);
  }

 

If not, are there any alternatives out there for this? 

Stanislav Korotky
23348
Stanislav Korotky  
Richard Read:

If not, are there any alternatives out there for this? 

You may create a helper expert which uses WebRequest internaly and then control it from an indicator using global variables or chart events.
Richard Read
336
Richard Read  
Stanislav Korotky:
You may create a helper expert which uses WebRequest internaly and then control it from an indicator using global variables or chart events.
Thank you, yes I have thought about doing this. But it is a bit frustrating for the person using the indicator to have to run an EA to get the indicator to work. 
Ex Ovo Omnia
3416
Ex Ovo Omnia  

Regarding the wininet, many of my customers do use a Mac. I can confirm that I am receiving quite ordinary https requests via wininet from their indicators.

Richard Read
336
Richard Read  
Ovo Cz:

Regarding the wininet, many of my customers do use a Mac. I can confirm that I am receiving quite ordinary https traffic from their indicators.

That's very interesting!

 

For all windows customers, my code works. For all MAC users, it doesn't work... can't understand it...

 

By the way I love your indicators, am using mean renko charts myself! 

To add comments, please log in or register