bool Hotkey::UnRegister() { if(_Identity==0) return 0; if(!::UnregisterHotKey(0,_Identity)) return 0; Function<bool,MSG*> cb; cb.Bind(this,&Hotkey::_CallBack); MsgLoop::DelMsgHook(cb); return 1; }
bool Hotkey::Register(WORD id,int key,bool shift,bool ctrl,bool alt,bool win){ if(_Identity) return 0; if(id==0) return 0; UINT mod = 0; if(shift) mod |= MOD_SHIFT; if(alt) mod |= MOD_ALT; if(ctrl) mod |= MOD_CONTROL; if(win) mod |= MOD_WIN; if(::RegisterHotKey(0,id,mod,key)){ _Identity = id; Function<bool,MSG*> func; func.Bind(this,&Hotkey::_CallBack); MsgLoop::AddMsgHook(func); return 1; } return false; }
bool AccelTable::Stop() { Function<bool,MSG*> cb; cb.Bind(this,&AccelTable::_CallBack); return MsgLoop::DelMsgHook(cb); }
bool AccelTable::Start() { Function<bool,MSG*> func; func.Bind(this,&AccelTable::_CallBack); return MsgLoop::AddMsgHook(func); }