public int Register(int modifier, Keys key, Form form, ActionDelegate action) { var r = new RegisteredKey() { modifier = modifier, key = (int)key, hWnd = form.Handle, form = form, action = action }; RegisteredKeys.Add(GetHashCode(r),r); if (RegisterHotKey(r.hWnd, r.id, r.modifier, r.key)) return r.id; else return 0; }
private int GetHashCode(RegisteredKey r) { return r.modifier ^ r.key ^ r.hWnd.ToInt32(); }