POSTMESSAGEW in MQL5 for MetaTrader 5

Hello. I need open de Experts Logs folder. I am using PostMessageW, but I do not know which is the flag for open that folder. Can anyone help me? Please.

Example:
PostMessageW(li_handleWindowMT5, WM_COMMAND, li_flag, 0);

For MT4 li_flag = 35435
But for MT5 not function.
Do you know which is the flag for MT5? I need open MQL5\logs for refresh the file log.

Thank you!!

Hi @cfgmalaga . You can consider accessing the log file and then read/write to it. First generate the file path like below then access it:

string path;
   MqlDateTime date;
   int i=0;
   TimeToStruct(TimeCurrent(),date);                            // Get current time
   StringConcatenate(path,"log\\log_", project_name,"\\log_", file,"_",
                     date.year,date.mon,date.day);              // Generate path and file name
   handleFile=FileOpen(path + ".txt",FILE_WRITE|FILE_READ|
                       FILE_UNICODE|FILE_TXT|FILE_SHARE_READ);  //

Make sure project_name and file variables are set correctly so the file path would be correct. After you get the file handle, reading it is like reading any other file. Hope this helps

1 Like