question for simple DLL

To add comments, please log in or register
fly7680
742
fly7680  

I created a simple DLL that reads a text file (http //: mysite.com/miofile.txt) from a server.

Everything works perfectly but in only one case in a Windos 7 PC the DLL could not communicate with the server and this function returned false. In addition to enabling DLLs in the MT4 you need to enable something else?
Or do you need to create an antivirus or firewall exception?

C++ code:

#include "stdafx.h"
#include <iostream>
#include <string>
#include <fstream>
#include <Windows.h>
#include <WinINet.h>
#include <sstream>
#pragma comment(lib, "WinINet.lib")


extern "C"
{
         
        __declspec(dllexport) int main()
        {

                std::wstring url = L"https://mysite.com/myfile+txt";            

                HINTERNET hopen = InternetOpen(L"MyAppName", INTERNET_OPEN_TYPE_PRECONFIG, NULL, NULL, 0);
                                
                if (hopen)
                {
                        DWORD flags = INTERNET_FLAG_DONT_CACHE;

                        if (url.find(L"https://") == 0) flags |= INTERNET_FLAG_SECURE;

                        HINTERNET hinternet = InternetOpenUrl(hopen, url.c_str(), NULL, 0, flags, 0);

                        // Ceck Connection Server!
                        if (hinternet)
                        {
                                MessageBox(NULL, "OK Connection".c_str(), B.c_str(), MB_ICONEXCLAMATION | MB_OK);
                        }
                        else
                        {
                                MessageBox(NULL, "No Connection".c_str(), D.c_str(), MB_ICONEXCLAMATION | MB_OK);
                        }

                        if (hinternet)
                        {
                             //... My code here
                        }
                }
         }
}
To add comments, please log in or register