Is there any information available on how to use a set of functions in a DLL to do custom writing or paiting of the chart window? Here is what I am trying to do:
I want to create graphic objects/display custom graphics using gdi32 calls such as DrawText, BitBlt etc. Is there sample code available anywhere? Any help is grteatly appreciated.
You should probably be able to draw over the top of the chart by subclassing the window's WM_PAINT message. Things will become very substantially harder/impossible if you want to draw into the chart background, or if you want to attach markers to specific bars.
You should probably be able to draw over the top of the chart by subclassing the window's WM_PAINT message. Things will become very substantially harder/impossible if you want to draw into the chart background, or if you want to attach markers to specific bars.
Thanks for your response.
I have some specific questions:
1. Do you know if I can expose a function in a DLL that can accept window handle as input and deliver the graphic on the screen?
2. Is there any sample code I can look at?
Thanks again
ForexTrader
1. Do you know if I can expose a function in a DLL that can accept window handle as input [...]
You can definitely do this bit...
I'm usually happy to knock together a DLL to investigate a matter of general interest (e.g. https://www.mql5.com/en/forum/124915), but I'm afraid I can't justify the time experimenting with something like this.
You can definitely do this bit...
I'm usually happy to knock together a DLL to investigate a matter of general interest (e.g. https://www.mql5.com/en/forum/124915), but I'm afraid I can't justify the time experimenting with something like this.
I made it work using gdi calls and also in DLL. The trouble is (as you mentioned), MT4 erases it when it redraws the candles. Any work around?
Possibly. Try subclassing the window, and doing your drawing at the end of the handling of each WM_PAINT message.
Possibly. Try subclassing the window, and doing your drawing at the end of the handling of each WM_PAINT message.
...Does work. Preventing flicker is a little fiddly.
Placing buttons and text fields would be more interesting (at least to me). Did you try this already and have some working code?
An easier method of doing the drawing, without flicker etc, would be the related route of creating a child window and drawing into that. However, MT4 appears to delete child windows on a chart within a couple of seconds of them getting created.
It's possible to simulate things like buttons (e.g. https://www.mql5.com/en/forum/115921), but I can't see a way of doing things like text fields. I seem to remember that I have come across someone who's done this successfully, but I'm not sure how it would work.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Is there any information available on how to use a set of functions in a DLL to do custom writing or paiting of the chart window? Here is what I am trying to do:
I want to create graphic objects/display custom graphics using gdi32 calls such as DrawText, BitBlt etc. Is there sample code available anywhere? Any help is grteatly appreciated.
Thanks
ForexWatchman