请问 IdleLib.dll 已经失效了么? 新评论 [删除] 2008.11.09 08:15 下载了 IdleLib.dll 拦按键信息, 但是没有任何信息出现, 难道这个库已经不能使用了? 我的测试代码如下: //+------------------------------------------------------------------+ //| 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); } } Help: IdleLib.dll don't use ? 这么个简单的程序为什么画不出线呢?请教牛牛们。 [Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. 新评论 您错过了交易机会: 免费交易应用程序 8,000+信号可供复制 探索金融市场的经济新闻 注册 登录 拉丁字符(不带空格) 密码将被发送至该邮箱 发生错误 使用 Google 登录 您同意网站政策和使用条款 如果您没有帐号,请注册 可以使用cookies登录MQL5.com网站。 请在您的浏览器中启用必要的设置,否则您将无法登录。 忘记您的登录名/密码? 使用 Google 登录
下载了 IdleLib.dll 拦按键信息,
但是没有任何信息出现,
难道这个库已经不能使用了?
我的测试代码如下:
//+------------------------------------------------------------------+
//| 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);
}
}