MQL4 - automated forex trading   /  

Forum

How to use DLL in MQL4

Back to topics list To post a new topic, please log in or register

avatar
23
draho 2007.11.28 09:30 

Hello,

I would like to use a DLL which includes some functions to work with POP3 protocol like Connect, Delete, Retrieve etc. I don't know how to define that DLL and those functions in MQL4 in order to get it work.

Once it is defined and I am able to use those functions I am able to code what I need.

I would very appreciate if anybody helps me start !

This is the link to the website with the description of the component http://www.pivo.com/doc/com/index.html because I don't even know whether it is possible to use this DLL in MQL4 environment.

Thanks a lot in advance!

article

Interview with Alexey (FXPro)

I prefer using several Expert Advisors trading different currency pairs - this gives the effect of the multi-currency profile trading.


avatar
582
irusoh1 2007.11.28 18:15 
look at winuser32.mqh

avatar
2462
phy 2007.11.28 20:54 

MT4 includes a sample dll

... in the Samples folder...

... called Sample DLL ...


avatar
23
draho 2007.11.29 08:02 

Hello guys,

I was actually trying to do it but no success.......

I did the following:

//+------------------------------------------------------------------+
//| PivoDLLs. mqh |
//| Copyright © 2004, MetaQuotes Software Corp. |
//| http://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#define copyright "Copyright © 2004, MetaQuotes Software Corp."
#define link "http://www.metaquotes.net/"

#import "Pivo.Pop3.dll"

void Connect(string user, string pass, string server);

//+------------------------------------------------------------------+

and then I don't know how to use it within 'int start()'

#include <PivoDLLs.mqh>

int start()
{

}

This is an example how to use it (from http://www.pivo.com/doc/com/index.html)

[C#]
string sLogin = "test";
string sPwd = "test";
string sServer = "pop3.test.com";

email =new Pop3Main( );
email.Connect(sLogin , sPwd , sServer);

here I am not sure how to define "email =new Pop3Main( );" so the Connect can be used in the code.

I would appreciate any help

Thanks


avatar
2462
phy 2007.11.29 08:43 

Have you successfully built and run the Sample.DLL?

C:\Program Files\MetaTrader\experts\samples\DLLSample

You are trying to do things you can't do.

MT4 will "call" the DLL, the DLL is permitted to return only a few types, shown in ExpertSample.cpp
http://docs.mql4.com/basis/preprosessor/import

You would do all the hard stuff in the DLL, and just return data to MT4, not a "mail object" .


avatar
23
draho 2007.11.29 09:00 
phy wrote:

Have you successfully built and run the Sample.DLL?

C:\Program Files\MetaTrader\MetaTrader\experts\samples\DLLSample

You are trying to do things you can't do with MT4.

MT4 will "call" the DLL, the DLL is permitted to return only a few types, shown in ExpertSample.cpp

You would do all the hard stuff in the DLL, and just return data to MT4, not a "mail object" .

Hey phy,

Yes I did try Sample.dll and it seemed not to be that difficult ;-)

But, then I didn't know that I have to define an Object in order to use it.

So you saying that I can't do it because objects are not possible to use in MT4, right?

What would you recommend in my case? I need to retrieve an e-mail from POP3 account and use some info from it. The problem is to retrieve the e-mail ;-)

Ok, thanks for your help and explanation.

Bye


avatar
2462
phy 2007.11.29 09:38 

"What would you recommend in my case? I need to retrieve an e-mail from POP3
account and use some info from it. The problem is to retrieve the e-mail "

Retrieve the Email using your DLL code and the Pivo objects.

---------------------

MT4 triggers the DLL to go get mail.

Write (or process, then write) the mail to a file in /experts/files using the DLL

MT4 queries the DLL to discover if there is new mail.

If yes, Use MT4 file functions to read the file.

Back to topics list  

To add comments, please log in or register