Expert Advisors • Indicators • Scripts • Libraries

MQL.RobotFX.org is the biggest collection of MetaTrader expert advisors (MT5 & MT4), indicators, scripts and libraries that can be used to improve trading results, minimize risks or simply automate trading tasks

Metatrader 5 Libraries | Keyboard

Library for keyboard operation:

  • Data of the selected keyboard layout.
  • Status and processing of pressed keys.

Example.

#include <fxsaber\Keyboard\Keyboard.mqh> // Working with keyboard data.

void OnChartEvent( const int id, const long &lparam, const double&, const string& )
{
  static const bool Init = KEYBOARD::FullControl(); // Allow full key interception.
  static string Str = NULL;

  if (id == CHARTEVENT_KEYDOWN)                              // If the key is pressed,
  {
    Print(KEYBOARD::Pressed(lparam) +                        // display the pressed combination
          ", KeysState: " + ToBits(KEYBOARD::KeysState()));  // output the key states.

    Str += KEYBOARD::Input(lparam);                          // Form a string of keys pressed since startup.
    
    Comment(EnumToString((ENUM_KEYCODE)lparam) +             // Output the pressed key.
            "\nKeyboard language: " + KEYBOARD::Language() + // Current keyboard language.
            "\nKeyboard country: " + KEYBOARD::Country() +   // Current keyboard country.
            "\n----------------\n" + Str);                   // Output a string of keys pressed since startup.
  }
}

An example of library operation.

48393

Best MetaTrader Indicators + Profitable Expert Advisors