public int task(int _taskId)
{
int ret;
#Task
if( _taskId == #taskAlt)
info("I am 'Alt'");
return true;
}那如果用户点击某些该宏不存在的键时想触发自己定义的处理代码该怎么办那?只能用WinAPI了.
1.在类WINAPI中添加如下静态方法供调用:
client static int getAsyncKeyState(int _key)
{
DLL dll = new DLL('USER32');
DLLFunction getAsyncKeyState = new DLLFunction(dll,'GetAsyncKeyState');
getAsyncKeyState.returns(ExtTypes::WORD);
getAsyncKeyState.arg(ExtTypes::DWORD);
return getAsyncKeyState.call(_key);
}
void catchKey()
{
int ctrl,shift,enter;
#define.bingo(32768)
;
ctrl = WinAPI::getAsyncKeyState(0x11);
shift = WinAPI::getAsyncKeyState(0xA0);
enter = WinAPI::getAsyncKeyState(0x0D);
if ( ctrl == #bingo &&
shift == #bingo &&
enter == #bingo)
{
info("Bingo");
}
this.setTimeOut("catchKey",10,false);
}
3.重载run方法,调用catchKey方法.
void run()
{
;
super();
element.catchKey();
}http://msdn2.microsoft.com/en-us/library/ms646293.aspx
OK,就这些了.

