Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Do not use this library has it?
I tested the code is as follows:
//+------------------------------------------------------------------+
//| myTest.mq4 |
//| Copyright ?2008, MetaQuotes Software Corp. |
//| https://www.metaquotes.net/ |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2008, MetaQuotes Software Corp."
#property link "https://www.metaquotes.net/"
#import "IdleLib.dll"
int GetLastKeyWP();
int GetLastMouseWP();
int IdleLibInit();
int IdleLibUnInit();
string GetActiveWndName();
#import
bool error;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
error = false;
if ( IsDllsAllowed() )
IdleLibInit();
else
Alert("Error: Dll Don't Call!");
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
if ( IsDllsAllowed() ) IdleLibUnInit();
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
if ( error ) { return(-1); }
if ( IsDllsAllowed() ) vHandsTrade_CheckKey();
//----
return(0);
}
//+------------------------------------------------------------------+
void vHandsTrade_CheckKey()
{
static int pre_pressed = 0;
static int pre_time = 0;
int i, now_pressed = GetLastKeyWP();
string name, lastwnd = GetActiveWndName();
Comment( StringConcatenate( "check_key(): now_pressed = ", now_pressed, ", lastwnd = ", lastwnd ) );
if( now_pressed != 0 && lastwnd != "" )
{
Print("wnd:",lastwnd," key:",now_pressed);
}
}