MQL4和DLL输入导出
Results 1 to 10 of 10

Thread: MQL4和DLL输入导出

  1. #1
    大家好我已经创建了一个DLL,它读取服务器上的文本文件中的数据,一切正常。
    现在我想在DLL中拆分URL并将部分路径作为输入参数传递给我的mql代码,但它不起作用。

    我的DLL是:

    插入代码extern C {__ declspec(dllexport)int main(std :: wstring Patc){std :: ofstream fout(Lc:\\ test \\ _ test.htm); std :: wstring url = Lhttps://mysite.com/ Patch; HINTERNET hopen = InternetOpen(LMyAppName,INTERNET_OPEN_TYPE_PRECONFIG,NULL,NULL,0); if(hopen){DWORD flags = INTERNET_FLAG_DONT_CACHE; if(url.find(Lhttps://)== 0)flags | = INTERNET_FLAG_SECURE; HINTERNET hinternet = InternetOpenUrl(hopen,url.c_str(),NULL,0,flags,0); if(hinternet){char buf#91; 10000#93 ;; DWORD收到= 0; int i; while(InternetReadFile(hinternet,buf,sizeof(buf),收到)){if(!received)break;/fout.write(buf,received); int I = 0; int II = 5; for(i = 0; i lt; = received; i ){// - 我的读代码很好!!!系统(PAUSE); InternetCloseHandle(hinternet); InternetCloseHandle(hopen); } return 0; }}
    我的代码Test Mql4是:

    插入代码#import Dll1.dll int main(string Patch); #import nt OnInit(){Print(Serial:,main(Read.txt));返回(INIT_SUCCEEDED); }

  2. #2

  3. #3

    Quote Originally Posted by ;
    请帮帮我?!?
    您已经向DLL传递了一个具有固定大小的char缓冲区,并在那里复制了字符串。稍后使用mt4字符串方法将其转换为字符串

  4. #4
    我不明白抱歉我可以给我一个例子谢谢!

  5. #5
    我试过这种方式,但它不起作用:插入代码__declspec(dllexport)int main(std :: string A){std :: string s(A); std :: wstring ws = ws.assign(A.begin(),A.end()); std :: wstring url2 = LReadCSV2.txt; std :: wstring url = Lhttps://mysite.com/; url = url L ws;/我的代码....}

  6. #6
    MQL4:#import XXX uint main(string a,char buffer []); #import string a; char * buffer []; main(a,buffer); C:__ declspec(dllexport)int main(std :: string A,void * buffer)

  7. #7

    Quote Originally Posted by ;
    我的DLL是:
    也许你开始以适当的方式发布代码?使用编辑器Source函数或将代码放入代码标记中。谁会费心阅读你乱七八糟的信件?其次,在\ MQL4 \ Scripts \ Examples \ DLL \ DLLSample.cpp下有一个如何处理东西的示例代码。

  8. #8

    Quote Originally Posted by ;
    {quote}也许你开始以适当的方式发布代码?使用编辑器Source函数或将代码放入代码标记中。谁会费心阅读你乱七八糟的信件?其次,在\ MQL4 \ Scripts \ Examples \ DLL \ DLLSample.cpp下有一个如何处理东西的示例代码。
    对不起,你说得对。我已经纠正了代码的格式

  9. #9

    Quote Originally Posted by ;
    MQL4:#import XXX uint main(string a,char buffer []); #import string a; char * buffer []; main(a,buffer); C:__ declspec(dllexport)int main(std :: string A,void * buffer)
    sI收到以下违规错误:访问冲突读取到DLL中的0xCCCCCCD0插入代码__declspec(dllexport)int main(std :: string A,void * buffer){std :: wstring ws = ws.assign(A.begin(), A.end()); std :: wstring url = Lhttps://mysite.com//; url = url L ws;/我的代码...} MQL4代码:插入代码#import Dll1.dll uint main(字符串a,char缓冲区#91;#93;); #import string a; char buffer#91;#93 ;; StringToCharArray(ReadCSV2.txt,buffer);

  10. #10

    Quote Originally Posted by ;
    {quote} sI收到以下违规错误:访问冲突读取到dll __declspec(dllexport)中的0xCCCCCCD0 int main(std :: string A,void * buffer){std :: wstring ws = ws.assign(A.begin() ,A.end()); std :: wstring url = Lhttps://mysite.com//; url = url L ws;/我的代码...} MQL4代码:#import Dll1.dll uint main(string a,char buffer []); #import string a; char buffer []; StringToCharArray(ReadCSV2.txt,buffer);
    不明白,但你不应该使用std作为字符串的参数。你应该将字符串作为变量传递。永远不要将字符串作为静态常量您应该在mql5 web中搜索示例。

發布權限

  • 您不可發布新主題
  • 您不可回复
  • 您不可發布附件
  • 您不可編輯您的帖子
  •  
  • BB代碼是打開的
  • 表情符號是打開的
  • [IMG]代碼是打開的
  • [視頻]代碼是打開的
  • HTML代碼是關閉的
forex-pedia網站使用cookie 文字跟蹤
forex-pedia.com網站使用cookie 文字跟蹤,某些設定已經固定。您可以點擊此處閱讀我們的Cookie使用說明。 請點擊右鍵接受我們的cookies。如果您選擇繼續使用forex-pedia.com網站,我們將認為您接受我們的cookies。