Win Socket WM_KEYDOWN has side effect. Ask for proper message word without side effect

 

The following post provided very useful mechanism for EA communication through  Win Socket.

https://www.mql5.com/en/blogs/post/706665

In the post, it uses WM_KEYDOWN as a message word to let OnChartEvent() receives a message with there is a packet arriving throught Win Socket.

      if (TerminalInfoInteger(TERMINAL_X64)) {
         WSAAsyncSelect(mSocket64, hWnd, 0x100 /* WM_KEYDOWN */, 0xFF /* All events */);
      } else {
         WSAAsyncSelect(mSocket32, (int)hWnd, 0x100 /* WM_KEYDOWN */, 0xFF /* All events */);
      }

The side effect is that in the server side, when I click a menu like Tools or Window, there will be a system sound continously. 

This side effect is annoying. I guess the MT4 Terminal can't not interprete WM_KEYDOWN message and make the sound.

I tried 0x101~0x10b or 0x400 to replace 0x100, but OnChartEvent() receives nothing. Obviously the message word is blocked by MT4 Terminal.

I'm looking for the proper message word which can be accepted by OnChartEvent() without side effect.

Best Regards!

Socket library for MT4 and MT5
Socket library for MT4 and MT5
  • 2017.09.06
  • www.mql5.com
[Published as a blog entry because submission to the Codebase stalled on the fact that this socket library works with both MT4 and MT5, whereas the Codebase is divided into separate sections for MT4
 

You should actually be commenting on the Blog comments and not here on the forum.

But for now, I have moved your topic to the section: MQL4 and MetaTrader 4

Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893