相关文章推荐
满身肌肉的风衣  ·  c++ - vulkan - ...·  2 年前    · 
俊逸的柠檬  ·  python - ValueError: ...·  3 年前    · 
安静的梨子  ·  C# ...·  3 年前    · 

Good afternoon,

I have a bunch of tools making use of the ghttp.mqh library to make an http call using the following function .

However, after updating to b600, the InternetOpenUrlA() function always returns zero.

Has anybody found a solution to this?

Thanks in advance.

bool HttpGET(string strUrl, string strWebPage)
  int hSession = InternetOpenA(AGENT, INTERNET_OPEN_TYPE_DIRECT, "0", "0", 0);
  int hReq = InternetOpenUrlA(hSession, strUrl, "0", 0,
             INTERNET_FLAG_NO_CACHE_WRITE |
             INTERNET_FLAG_PRAGMA_NOCACHE |
             INTERNET_FLAG_RELOAD, 0);
  if (hReq == 0) {
    return(false); // False is always returned
  // ... more lines of code here
		          

See the many other cases here on the forum where one has to substitute the "A" version for "W" version of functions (Wide Unicode). In other words, "InternetOpenW" instead of "InternetOpenA".

However, since many data types have changed in the new build you will have to verify that parameters/arguments used are in agreement with the definition.

FMIC:

See the many other cases here on the forum where one has to substitute the "A" version for "W" version of functions (Wide Unicode). In other words, "InternetOpenW" instead of "InternetOpenA".

However, since many data types have changed in the new build you will have to verify that parameters/arguments used are in agreement with the definition.

Hi Fmic, thanks for your reply. The InternetOpenW function does not exist on the library :-(

I dont understand how did you fix the problem.

Re-Coding wininet.dll and how or something else ?

Thanks

I dont understand how did you fix the problem.

Re-Coding wininet.dll and how or something else ?

Thanks

Maybe there's a mismatch between the versions of WiniNet (the old one for which the ghttp.mqh library was conceived, and the new one).

If you have a number of different apps that now have crashed, then you should adapt to this new situation and try to hack the old ghttp.mqh library by updating the WiniNet calls to InternetOpen or InternetOpenUrl.

There's WiniNet API here.

I dont understand how did you fix the problem.

Re-Coding wininet.dll and how or something else ?

Thanks

Welcome to mql4.com forum,

Did you read this topic https://www.mql5.com/en/forum/149321. Maybe it can help you.

Hi and are you trying the HttpPost? i have modify the ghttp but im not able to fix it.

this are myc hanges in the import

bool InternetCanonicalizeUrlW(string lpszUrl, string lpszBuffer, int& lpdwBufferLength[], int dwFlags);
int InternetOpenW(string sAgent, int lAccessType, string sProxyName="", string sProxyBypass="", int lFlags=0);
int InternetOpenUrlW(int hInternetSession, string sUrl, string sHeaders="", int lHeadersLength=0, int lFlags=0,
   int lContext=0);
int InternetReadFile(int hFile, uchar & sBuffer[], int lNumBytesToRead, int& lNumberOfBytesRead[]);
int InternetCloseHandle(int hInet);
int InternetConnectW(int handle, string host, int port, string user, string pass, int service, int flags, int context);
bool HttpSendRequestW(int handle, string headers, int headersLen, int& optional[], int optionalLen);
bool HttpAddRequestHeadersW(int handle, string headers, int headersLen, int modifiers);
int HttpOpenRequestW(int hConnect, string lpszVerb, string lpszObjectName, string lpszVersion,
 string lpszReferer, uchar & lplpszAcceptTypes[], int dwFlags, int dwContext);

when i try to compile it im getting some warning but no errors:

 arrays passed by reference only        ghttp.mqh       140     50// HttpGet function
arrays passed by reference only ghttp.mqh       140     69// HttpGet function
truncation of constant value    ghttp.mqh       113     38 // hReq
truncation of constant value    ghttp.mqh       166     50//dwOpenRequestFlags
 truncation of constant value   ghttp.mqh       183     79 // HttpAddRequestHeadersW with he HTTP_ADDREQ_FLAG_REPLACE

and after testing in a indicator im getting error Access violation read to 0x80000200 in 'wininet.dll'

Are you trying the same or just GET?





  • Online trading / WebTerminal
  • Free technical indicators and robots
  • Articles about programming and trading
  • Order trading robots on the Freelance
  • Market of Expert Advisors and applications
  • Follow forex signals
  • Low latency forex VPS
  • Traders forum
  • Trading blogs
  • Charts
  • Free widgets
  • MetaTrader 5 Trading Platform
  • MetaTrader 5 latest updates
  • News, implementations and technology
  • MetaTrader 5 User Manual
  • MQL5 language of trading strategies
  • MQL5 Cloud Network
  • MQL5 Algo Forge
  • Download MetaTrader 5
  • Install Platform
  • Uninstall Platform
  • Economic Calendar