How to use DLL in MQL4

 

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!

 
look at winuser32.mqh
 

MT4 includes a sample dll

... in the Samples folder...

... called Sample DLL ...

 

Hello guys,

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

I did the following:

//+------------------------------------------------------------------+
//| PivoDLLs. mqh |
//| Copyright © 2004, MetaQuotes Software Corp. |
//| https://www.metaquotes.net// |
//+------------------------------------------------------------------+
#define copyright "Copyright © 2004, MetaQuotes Software Corp."
#define link "https://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

 

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
https://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" .

 
phy:

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

 

"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.