public HotKeyForm(MOD_KEY modKey, Keys key, ThreadStart proc) { this.proc = proc; for (int i = 0x0000; i <= 0xbfff; i++) { if (RegisterHotKey(this.Handle, i, modKey, key) != 0) { id = i; break; } } }
public HotKeyForm(MOD_KEY modKey, Keys key, ThreadStart proc) { this.proc = proc; for (int i = 0x0000; i <= 0xbfff; i++) { if (RegisterHotKey(this.Handle, i, modKey, key) != 0) { id = i; break; } } }
public HotKeyForm(MOD_KEY modKey, Keys key, ThreadStart proc) { this.proc = proc; for(int i = 0x0000; i <= 0xbfff; i++) { if(RegisterHotKey(this.Handle, i, modKey, key) != 0) { id = i; break; } } }
public HotkeyForm(MOD_KEY ModKey, Keys Key, ThreadStart proc) { this.Proc = proc; for (int i = 0x0000; i <= 0xbfff; i++) { if (User32.RegisterHotKey(this.Handle, i, (int)ModKey, (int)Key) != 0) { Id = i; break; } } }
public HotKeyRegister(MOD_KEY MOD_KEY, Keys key, IntPtr windowHandle) { Contract.Requires(MOD_KEY != MOD_KEY.None || key != Keys.None); Contract.Requires(windowHandle != IntPtr.Zero); Key = key; KeyModifier = MOD_KEY; id = GetHashCode(); handle = windowHandle; RegisterHotKey(); ComponentDispatcher.ThreadPreprocessMessage += ThreadPreprocessMessageMethod; }
/// <summary> /// 新規のホットキーを登録します。 /// </summary> /// <param name="MOD_KEY">修飾キー</param> /// <param name="Key">キー</param> /// <param name="Window">親ウィンドウ</param> public HotKeyRegister(MOD_KEY MOD_KEY, System.Windows.Forms.Keys Key, System.Windows.Window Window) { var windowHandle = new WindowInteropHelper(Window).Handle; Contract.Requires(MOD_KEY != MOD_KEY.None || Key != Keys.None); Contract.Requires(windowHandle != IntPtr.Zero); this.Key = Key; KeyModifier = MOD_KEY; var r = new Random(); id = r.Next(); handle = windowHandle; RegisterHotKey(); ComponentDispatcher.ThreadPreprocessMessage += ThreadPreprocessMessageMethod; }
/// <summary> /// ホットキーを指定して初期化する。 /// 使用後は必ずDisposeすること。 /// </summary> /// <param name="modKey">修飾キー</param> /// <param name="key">キー</param> public HotKey(MOD_KEY modKey, Keys key) { if ((key & Keys.Control) != 0) { modKey |= MOD_KEY.CONTROL; } if ((key & Keys.Shift) != 0) { modKey |= MOD_KEY.SHIFT; } if ((key & Keys.Alt) != 0) { modKey |= MOD_KEY.ALT; } key -= Keys.Control; key -= Keys.Shift; key -= Keys.Alt; form = new HotKeyForm(modKey, key, raiseHotKeyPush); }
private void SetHotkey() { KeysConverter convert = new KeysConverter(); MOD_KEY modKeys = 0; if (MainIni.UseAlt) { modKeys |= MOD_KEY.ALT; } if (MainIni.UseCtrl) { modKeys |= MOD_KEY.CONTROL; } if (MainIni.UseShift) { modKeys |= MOD_KEY.SHIFT; } hotKey = new HotKey(modKeys, (Keys)convert.ConvertFromString(MainIni.ShortcutKey)); hotKey.HotKeyPush += new EventHandler(ImageCapButton_Click); }
public HotKey(Keys key, EventHandler handler) { MOD_KEY modKey = 0; if ((key & Keys.Control) != 0) { modKey |= MOD_KEY.CONTROL; } if ((key & Keys.Shift) != 0) { modKey |= MOD_KEY.SHIFT; } if ((key & Keys.Alt) != 0) { modKey |= MOD_KEY.ALT; } key = (Keys)((int)key & 0xff); form = new HotKeyForm(modKey, key, raiseHotKeyPush); HotKeyPush += handler; }
// ホットキーの登録 private void RegisterHotKeyWrap() { if (hotKey != null) { hotKey.Dispose(); } Keys key = (Keys)hotKeys.SelectedValue; if (key == Keys.None) { return; } MOD_KEY modKey = 0; modKey |= enableCtrl.Checked ? MOD_KEY.CONTROL : 0; modKey |= enableShift.Checked ? MOD_KEY.SHIFT : 0; modKey |= enableAlt.Checked ? MOD_KEY.ALT : 0; hotKey = new HotKey(modKey, key); hotKey.HotKeyPush += new EventHandler(hotKey_HotKeyPush); }
/// <summary> /// ホットキー登録 /// </summary> /// <param name="HWnd">ウィンドウハンドル</param> /// <param name="id">キーID</param> /// <param name="modKey">修飾キー</param> /// <param name="key">キー(アルファベットのみ)</param> /// <returns>true/false</returns> public bool SetHotKey(IntPtr HWnd, int id, MOD_KEY modKey, Key key) { if (this.HWnd != IntPtr.Zero && this.HWnd != HWnd) { return(false); } this.HWnd = HWnd; var ret = RegisterHotKey(HWnd, id, modKey, AKEY + key - Key.A); if (ret == 0) { return(false); } //メッセージハンドラ if (!procSet) { var source = System.Windows.Interop.HwndSource.FromHwnd(HWnd); source.AddHook(new System.Windows.Interop.HwndSourceHook(WndProc)); procSet = true; } return(true); }
/// <summary> /// ホットキーを指定して初期化する。 /// 使用後は必ずDisposeすること。 /// </summary> /// <param name="modKey">修飾キー</param> /// <param name="key">キー</param> public HotKey(MOD_KEY modKey, Keys key) { m_Form = new HotKeyForm(modKey, key, raiseHotKeyPressed); }
extern static int RegisterHotKey(IntPtr HWnd, int ID, MOD_KEY MOD_KEY, Keys KEY);
/// <summary> /// ホットキーを指定して初期化する。 /// 使用後は必ずDisposeすること。 /// </summary> /// <param name="modKey">修飾キー</param> /// <param name="key">キー</param> public HotKey(MOD_KEY modKey, Keys key) { form = new HotKeyForm(modKey, key, raiseHotKeyPush); }
private static extern int RegisterHotKey(IntPtr hWnd, int id, MOD_KEY fsModifiers, Keys vk);
/// <summary> /// ホットキーを指定して初期化する。 /// 使用後は必ずDisposeすること。 /// </summary> /// <param name="modKey">修飾キー</param> /// <param name="key">キー</param> public HotKey(MOD_KEY modKey, Keys key) { form = new HotKeyForm(modKey, key, raiseHotKeyPush); }
public HotKeyRegister(MOD_KEY MOD_KEY, Keys key, WindowInteropHelper window) : this(MOD_KEY, key, window.Handle) { }
public HotKeyRegister(MOD_KEY MOD_KEY, Keys key, Window window) : this(MOD_KEY, key, new WindowInteropHelper(window)) { }
public static extern bool RegisterHotKey(IntPtr hWnd, int id, MOD_KEY fsModifiers, Keys vk);
public HotKey(MOD_KEY modKey, Keys key, EventHandler handler) { form = new HotKeyForm(modKey, key, raiseHotKeyPush); HotKeyPush += handler; }
public HotkeyData(Keys KeyCode, MOD_KEY ModKey) { this.KeyCode = KeyCode; this.ModKey = ModKey; }
/// <summary> /// コンストラクタ /// </summary> public HotkeyData() { this.KeyCode = Keys.None; this.ModKey = MOD_KEY.NONE; }
extern static int RegisterHotKey(IntPtr HWnd, int ID, MOD_KEY MOD_KEY, Keys KEY);
static extern int RegisterHotKey(IntPtr HWnd, int ID, MOD_KEY MOD_KEY, Keys KEY);
extern static int RegisterHotKey(IntPtr HWnd, int ID, MOD_KEY ModKey, int KEY);
/// <summary> /// ホットキーを指定して初期化する。 /// 使用後は必ずDisposeすること。 /// </summary> /// <param name="modKey">修飾キー</param> /// <param name="key">キー</param> public HotKey(MOD_KEY modKey, Keys key) { form = new HotKeyForm(modKey, key, raiseHotKeyPush); }
private static extern int RegisterHotKey(IntPtr HWnd, int ID, MOD_KEY MOD_KEY, Keys KEY);
public Hotkey(MOD_KEY ModKey, Keys Key) { Form = new HotkeyForm(ModKey, Key, RaiseHotkeyPush); }
/// <summary> /// ホットキーを指定して初期化する。 /// 使用後は必ずDisposeすること。 /// </summary> /// <param name="modKey">修飾キー</param> /// <param name="key">キー</param> public HotKey(MOD_KEY modKey, Keys key) => m_Form = new HotKeyForm(modKey, key, RaiseHotKeyPressed);