Trabajo finalizado
Tarea técnica
Can someone write me a script that will force the experts log file to refresh in real time?
I've written an EA that reads in and uses some information from the experts log file, so I need it to refresh in real time. However, the log file is only updated in intervals throughout the day I think, when the terminal is closed, or when you right click on the log in the terminal and click open.
I have some code (below) that uses WinAPI functions to do something similar with the "Journal" file. It performs the "right click and open" process on the journal repeatedly to keep it updated.
So there are two possible solutions to my problem:
1. Modify the code below for me, to perform the process on the "Experts Log" file instead - I have been unable to do this myself as I don't have any experience with WinAPI and don't know the equivalent code to the "33101" to reference the Experts Log.
2. Produce a better solution for refreshing the log file - opening and closing the file folder every few ticks is far from ideal. So you may know a better or more efficient solution to solve my problem. (I will pay more for a better and more efficient solution if more time is involved).
Please contact me to discuss further...
#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); }