import mouse.hook;
var hook = mouse.hook();
//录制回调函数
hook.proc = function(msg,x,y,mouseData,injected,flags,timeStamp,extraInfo){
if( injected ) return; //模拟鼠标不处理
select(msg) {
case 0x201/*_WM_LBUTTONDOWN*/{
console.dump("左键按下",x,y)
}
case 0x202/*_WM_LBUTTONUP*/{
console.dump("左键弹起",x,y)
}
case 0x204/*_WM_RBUTTONDOWN*/{
console.dump("右键按下",x,y)
}
case 0x205/*_WM_RBUTTONUP*/{
console.dump("右键弹起",x,y)
}
case 0x207/*_WM_MBUTTONDOWN*/{
console.dump("中键按下",x,y)
}
case 0x208/*_WM_MBUTTONUP*/{
console.dump("中键弹起",x,y)
}
}
}