Discussion of article "DIY multi-threaded asynchronous MQL5 WebRequest" - page 6

 
Mihail Matkovskij:
What should be the offset (input int MessageBroadcast) for user events if UI elements from the standard library(Include\Controls\) are used in the programme? How can I find out?

I am not a big library expert. Judging by the definition of events in the Defines.mqh file, the maximum reserved index there is 100.

 
Stanislav Korotky:

I am not a big expert of the library. Judging by the definition of events in the Defines.mqh file, the maximum reserved index there is 100.

//+------------------------------------------------------------------+
//| Events|
//+------------------------------------------------------------------+
#define  ON_CLICK                (0)   // clicking on control event
#define  ON_DBL_CLICK            (1)   // double clicking on control event
#define  ON_SHOW                 (2)   // showing control event
#define  ON_HIDE                 (3)   // hiding control event
#define  ON_CHANGE               (4)   // changing control event
#define  ON_START_EDIT           (5)   // start of editing event
#define  ON_END_EDIT             (6)   // end of editing event
#define  ON_SCROLL_INC           (7)   // increment of scrollbar event
#define  ON_SCROLL_DEC           (8)   // decrement of scrollbar event
#define  ON_MOUSE_FOCUS_SET      (9)   // the "mouse cursor entered the control" event
#define  ON_MOUSE_FOCUS_KILL     (10)  // the "mouse cursor exited the control" event
#define  ON_DRAG_START           (11)  // the "control dragging start" event
#define  ON_DRAG_PROCESS         (12)  // the "control is being dragged" event
#define  ON_DRAG_END             (13)  // the "control dragging end" event
#define  ON_BRING_TO_TOP         (14)  // the "mouse events priority increase" event
#define  ON_APP_CLOSE            (100) // "closing the application" event

Obviously, from 15 to 99 the developers left a reserve for new event id. But in addition to this, another constant caught my eye.

#define  CONTROLS_MAXIMUM_ID                 (10000)  // maximum number of IDs in application

Maximum number or maximum number of id's in the application. What can it mean...?

 
Mihail Matkovskij:

Obviously, from 15 to 99 the developers left a margin for new id events. But in addition to this, another constant caught my eye.

Maximum number or maximum number of ids in the application. What can it mean...?

According to the words - control identifiers. Controls are not events.

 
Stanislav Korotky:

Judging by the words - control identifiers. Controls are not events.

Maybe... But it doesn't say what identifiers. I set MessageBroadcast 10000 and everything works. You can set even 1000000 and more, the ushort type allows it. Although even with 100 there will be no conflicts. In any case, any UI element has its own id, which is checked in the conditions of event processing. In general, the probability of normal operation is quite high.

 
It would be nice if the main expert could get the CPU load to know how many tasks can be added for execution. But unfortunately I have not found such a function in the documentation.
 
Stanislav Korotky #:


How would this be designed now that there are services in MT5?

 
bot #:

How would this be designed now that there are services in MT5?

It changes nothing as there is no easier way to communicate with an MT5 service.
 

Really nice article.

However I get issues when trying to compile with metatrader 5.

Initialise sequence for array expected:

in template 'const TYPETOBYTES::STRUCT_TYPE<T> TYPETOBYTES::FillBytes(const uchar)' specified with [T=uchar] TypeToBytes.mqh 314 31

I understand that it is an issue initilising the array. I could try to fix it. However, I dont see any report of this issue, wondering whether it is only my self facing the issue.

Thanks for the article anywell, wonderful anyway!



 
magnomilk #:

Really nice article.

However I get issues when trying to compile with metatrader 5.

Initialise sequence for array expected:

in template 'const TYPETOBYTES::STRUCT_TYPE<T> TYPETOBYTES::FillBytes(const uchar)' specified with [T=uchar] TypeToBytes.mqh 314 31

I understand that it is an issue initilising the array. I could try to fix it. However, I dont see any report of this issue, wondering whether it is only my self facing the issue.

Thanks for the article anywell, wonderful anyway!



Make sure you're using the latest TypeToBytes library.

 
Igor K "WebRequest error code 4002"....


MetaTrader 5

Version: 5.00 build 2093

02 Jul 2019


===cut here===

2019.07.23 00:47:37.182 multiwebclient (USDJPY,H1) Accepted: aQuotes\Terminal\D0E8209F77C8CF37AD8BF550E51FF075\MQL5\Experts\multiwebclient.ex5::USDJPY_PERIOD_H1_2_128968169154443359 after 0 retries

2019.07.23 00:47:37.182 multiwebclient (USDJPY,H1) WebRequest error code 4002

===cut here===


Only ports 80 (http) and 443 (https) are allowed for WebRequest.