Download MetaTrader 5

Code to Reference the Experts Log Folder with PostMessageW

To add comments, please log in or register
Sign up for MQL5.community to leave your comments!
James Parker
920
James Parker 2016.01.12 09:56 

Hi,

I'm working with the WinAPI functions and I want my code to open the folder containing the Experts Log.

Does anyone know the code to use in PostMessageW to reference the Experts Log?

Does a list of these codes and their commands exist anywhere? 

 

I have a script (below) that will do this with the Journal folder using code "33101" - I need to find the corresponding code to Experts Log.

 

#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.
  PostMessageW(hwnd,WM_COMMAND ,33101,0); // open the folder contains the log files
  //-----
  while (FindIfDirOpened() == 0) // check if the folder opened
      {
      Sleep(100);
      FindIfDirOpened();
      }
   PostMessageW(FindIfDirOpened(), WM_CLOSE, 0, 0); //close the folder
}

int FindIfDirOpened()
   {
   string log = "logs";
   string i;
   int handle = FindWindowW(i ,log);
   return(handle);
   }
To add comments, please log in or register