下载MetaTrader 5
要添加评论,请登录注册
注册为卖方开始盈利吧!
烛之舞
23
烛之舞 2008.11.09 08:15 

下载了 IdleLib.dll 拦按键信息,

但是没有任何信息出现,

难道这个库已经不能使用了?

我的测试代码如下:

//+------------------------------------------------------------------+
//| myTest.mq4 |
//| Copyright ?2008, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright ?2008, MetaQuotes Software Corp."
#property link "http://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);
}

}

/
要添加评论,请登录注册