New article Managing the MetaTrader Terminal via DLL has been published on mql5.com:
The article deals with managing MetaTrader user interface elements via
an auxiliary DLL library using the example of changing push notification
delivery settings. The library source code and the sample script are
attached to the article.
We have a MetaQuotes ID list containing more than four delivery addresses. As we know, the SendNotification
function uses only the IDs set in the Notifications tab of the Options
window. Thus, you can send push notifications solely to the previously
specified IDs no more than four at a time by means of MQL. Let's try to
The issue can be solved in two ways –
we can either develop the push notification delivery function from
scratch, or change the terminal settings and use the standard function.
The first option is quite time-consuming and lacks universality.
Therefore, I have selected the second one. In their turn, the terminal
settings can also be changed in various ways. According to my
experience, this can be done via the user interface or by substituting
values in the process memory. Working with memory looks much better
since it allows users to avoid flashing windows. However, it can disrupt
the operation of the entire terminal at the slightest mistake. The
worst thing that may happen when working via the UI is a disappearance
of a window or a button.
In this article, we will look at
managing the terminal via the user interface using an auxiliary DLL
library. In particular, we will consider changing the settings.
Interaction with the terminal will be performed in usual way, which
means using its windows and components. No interference with the
terminal process will take place. This method can be applied to solve
other issues as well.
1.3. Working with a Menu
Like all other components, working with
a menu starts after a parent handle (a certain window) is found. Then,
we should find corresponding menu item and sub-item and perform a
Please note: the amount of the terminal menu items changes depending on whether a chart window is expanded or not (see Fig. 2). Item enumeration starts from 0.
Fig. 2. Changing the amount of the menu items
Author: Galina Bobro