reading the Journal in real time

 

unfortunately I have not found yet the right way how to do this but at least i found a detour if anyone has a direct way to do that i would be grateful

the way i found is by forcing the terminal to save the data through opening the folder that contains the log files

#include <WinUser32.mqh>

#import "user32.dll"
  int GetAncestor(int hWnd, int gaFlags);
#import
//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
void start()
{
  int hwnd = GetAncestor(WindowHandle(Symbol(),Period()),2); // find the Terminal handle no.
  PostMessageA(hwnd,WM_COMMAND ,33101,0); // open the folder contains the log files
  //-----
  while (FindIfDirOpened() == 0) // check if the folder opened
      {
      Sleep(100);
      FindIfDirOpened();
      }
   PostMessageA(FindIfDirOpened(), WM_CLOSE, 0, 0); //close the folder
}

int FindIfDirOpened()
   {
   string log = "logs";
   string i;
   int handle = FindWindowA(i ,log);
   return(handle);
   }
 
Yes, but open the log folder before MQL4...   ....\uniquenumber\log NOT the one on ...\uniquenumber\MQL4\Logs 
 

qjol... the code doesnt work at this time... 

the function FindWindows doesn't allow string , request order type 



'i' - variable of the same type expected


 

This code works fine.


#import "user32.dll"

  int GetAncestor(int hWnd, int gaFlags);

#import

void updatelog()

{
  int hwnd = GetAncestor(WindowHandle(Symbol(),Period()),2); // find the Terminal handle no.
  PostMessageW(hwnd,WM_COMMAND ,33101,0); // open the folder contains the log files 

  //-----
  bool find=false;
  for(int i=0;i<20;i++)
    {
     Sleep(100);
     int LogHandle= FindIfDirOpened();
     if(LogHandle!=0)
       {
           find=true;
           PostMessageW(FindIfDirOpened(), WM_CLOSE, 0, 0); //close the folder
       }
       else if(find)
              {
               break;
              }
    }


}

int FindIfDirOpened()
   {
   // string log = "logs";
   string classname="CabinetWClass";
   int handle = FindWindowW(classname ,NULL);

   return(handle);

   }   


void OnTick()

  {

//---

if (Seconds()<3){ if (Minute()<20 )   updatelog(); if (Minute()>40 )   updatelog();/*Print(Seconds());*/}

  }

 
Hi carlos.rav, Does your code work in mql4? if not, what modifications does it need to work as it does in mql5?
 
This solution does not work, log cache does not get dumped to the log files.
Reason: