David, sepertinya ada beberapa masalah dengan build 402. Coba lihat di sini danOriginally Posted by ;
http://forum.mql4.com/40874/page3. Saya telah melacak jalannya EA dan ada hal-hal aneh yang terjadi. Pertama: jika mis. kerangka waktu diaktifkan, fungsi IsStopped () mql4 mengembalikan true. Ini adalah fakta yang diketahui (jelas tidak berdokumen) bahwa sementara IsStopped () = true, memanggil fungsi user32.dll menyebabkan MT4 hang selama beberapa detik. Tidak apa-apa, tetapi saya mendaftar bahwa IsStopped () tampaknya tetap benar setelah perubahan TF kadang-kadang (!) Di build 402. Dalam satu kasus saya perhatikan itu berubah benar dan kembali ke false selama dua detik, tanpa melakukan apa pun di mana pun, tanpa alasan apa pun. Itu gila. Kedua: InputResizer mengubah atribut dari jendela input sehingga Windows mulai memperlakukannya sebagai resizable. Karenanya panah muncul ketika Anda mengarahkan perbatasan dengan penunjuk tetikus, dan ukuran jendela sebenarnya seperti yang biasa kita lakukan. Tetapi kontrol di dalam (tombol, tab, formulir) tetap tidak disadari di tempat asalnya:
The reason for that is MT4 calls the DWM (Desktop Window Manager) to plot and manage the window and passes its style as non-resizable. I can't patch the MT4 executable to change this tiny bit since it's packed (protected against reverse engineering the code) with Themida. And I don't know of any way of telling the DWM to do the unexpected since i'm not MT4 - the appliion that ordered the window. So there's only one way - once IR makes the window resizeable and applies init coordinates, it checks if the window was resized between ticks (indy) or sleep interval (EA), and if yes, then all the inner elements are moved/sized one-by-one as necessary, relative to new position/size. Now, if IsStopped() becomes true, the EA has cca 2 seconds to complete its operation. That's ok if there are reasons for it to be true; the legitimate reasons are: TF switch, EA detachment, account change, own settings change. Maybe there are some others, but I can't imagine a legit reason for IsStopped() to become true while you have (some) input window open. But it simply happens. I guess the hang is caused by the EA calling the Windows API and forcedly being stopped by MT4 in the middle of something. Of course, I might be wrong. The missing repaint (your pic) issue can happen sometimes; it's exactly as you describe. It's an innocent bug and I think we have to live with it. The content is correct, just not drawn. This is (again) caused by the fact the DWM doesn't care of our window. There's a function in code: Inserted Code/This causes the box to redraw, otherwise we get artefacts InvalidateRect(pWnd, s, true); that takes care of repainting the content if we spot the coordinates changed. In previous version this was done if width or height changed, now we repaint even if just dragged. I tried to do this on every tickpass, but it flickers badly. For now, I removed all references to IsStopped() in the EA code. The drawback now is slow response on switching timeframes, but the EA should not lose focus with the API now. I recommend to attach the EA to a dedied chart. It can reside in any running instance on your PC. Update in post #1, please try out and let me know. I very appreciate your assistance. However, I see that's really out of sense to have this window hack implemented in (any) mql4 form.. I will code this utility as a native Win32 appliion, sitting in the system tray. And I guess all problems will be gone. Never done it, but hey, I need to learn it
Saya ingin memberi kode platform saya sendiri untuk pengujian di tahun berikutnya. Terima kasih untuk semua yang menyukainya!