PostMessageA from Metaeditor?

 

Hi MQL4 Community,

i am currently playing with an IDE for MQL via Notepad++. I can compile etc perfectly but i wish to implement the function of metaeditor.exe which does re-apply the EA to chart (re-initialising). I think there is a special PostMessageA for this.

Does someone know more about this please?

regards

fx1.net

 
communication consists of two messages. no pointers, nothing unique whatever you compile, seems to be some kind of wm_notify to check mql dirs for changes. i'm not sure if lParam stays constant between restarts.




regards,:-)
 
fx1.net:
i am currently playing with an IDE for MQL via Notepad++. I can compile etc perfectly but i wish to implement the function of metaeditor.exe which does re-apply the EA to chart (re-initialising). I think there is a special PostMessageA for this.
  1. I personally use Notepad2 with code folding.
  2. When you compile, the editor already reloads the EA (not in the ST.) Uninitialize reason code: REASON_RECOMPILE 2 Expert recompiled. Why do you need a special post message?
 
WHRoeder:
  1. I personally use Notepad2 with code folding.
  2. When you compile, the editor already reloads the EA (not in the ST.) Uninitialize reason code: REASON_RECOMPILE 2 Expert recompiled. Why do you need a special post message?


WHRoeder: are you coding in Notepad2 and compiling in MetaEditor? MetaEditor seems to send special command to terminal to Refresh the EA on chart. I am looking to simulate this. Everything else is working actually.

 
emmzettel:
communication consists of two messages. no pointers, nothing unique whatever you compile, seems to be some kind of wm_notify to check mql dirs for changes. i'm not sure if lParam stays constant between restarts.




regards,:-)

emmzettel, tx for quick answer. It does not look like its watching for changes. Looks like MetaEditor sends something to Terminal.exe from my perspective. Which tool did you use to capture the Messages please?
 
fx1.net:

WHRoeder: are you coding in Notepad2 and compiling in MetaEditor?

MetaEditor seems to send special command to terminal to Refresh the EA on chart.

I am looking to simulate this. Everything else is working actually.

  1. yes
  2. it does (according to the documentation.)
  3. why?
 
WHRoeder:
  1. yes
  2. it does (according to the documentation.)
  3. why?


2) I want to know exactly what it sends to Terminal.exe to refresh the chart

3) To save time, i have my compile.bat which compiles the .mq4 using metalang.exe compiler, but after this EA does not get reloaded automatically. I dont want use Metaeditor.exe at all, thats what i want. My software packages are huge and metaeditor is too weak for my needs atm.

 
fx1.net:

It does not look like its watching for changes. Looks like MetaEditor sends something to Terminal.exe from my perspective. Which tool did you use to capture the Messages please?
of course it isn't watching. the screenshot shows metaeditor first sending a message to terminal, and almost immediately posting another one. so i assume it goes like this:

1) SendMessage() to inform terminal a recompilation is about going to take place. maybe it's not about recompilation but about notification mqlcache.dat is going to be invalidated soon. notice the return value, theoretically terminal could bail. without this using SendMessage makes no sense at all but what do i know...

2) PostMessage() to finally confirm invalidation of mqlcache.dat. *Now* (not before) terminal compares the ex4 files with mqlcache data and updates accordingly. in case of changes it reloads the ea.

This makes sense because the messages do *not* contain any mql file specific hints. There is no other way then to compare all files with mqlcache to detect what exactly changed.
Just try and play around with it and you will know more.

Of course, i might be wrrrrrrronnng (as somebody famous used to say...). and don't leave us glueless about your findings before releasing the next fx1 product.

the tool is Winspector but any message recorder with editable filter settings will do.

regards

 
and btw: the messages *might* come from from metalang instead from the editor. this i didn't evaluate.
 

Finally, and i think this should it be:

there is a race condition. if terminal.exe detects a timestamp difference it's compiling by itself. we must avoid the situation when terminal.exe and metaeditor.exe start the compiler for the same file at the same time, so it needs some kind of synchronization. this is were the two messages come into play. the first notifys and asks "may i compile?". if terminal.exe agrees editor launches the compiler. after finishing it confirms by PostMessage ("i'm done"). by contract terminal.exe will not launch the compiler until it receives the done-message. without synchronization we might run into problems with two compiler processes trying to create the same compile log etc...

just my 2 cents

 

emmzettel; you are right. Terminal does not care about much details.

PostMessageA((IntPtr)hwndTerminal, TickMessage, 0x0000303D, 0xC27F);

this command forces Terminal.exe to check all .ex4 files again and reload changed .ex4. Happy to have solved this issue!