Esempio n. 1
0
 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;
         }
     }
 }
Esempio n. 2
0
 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;
         }
     }
 }
Esempio n. 3
0
         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;
                             
         }
                     
     }
             
 }
Esempio n. 4
0
 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;
         }
     }
 }
Esempio n. 5
0
		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;
		}
Esempio n. 6
0
        /// <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;
		}
Esempio n. 7
0
 /// <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);
 }
Esempio n. 8
0
        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);
        }
Esempio n. 9
0
    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;
    }
Esempio n. 10
0
        // ホットキーの登録
        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);
        }
Esempio n. 11
0
        /// <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);
        }
Esempio n. 12
0
 /// <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);
 }
Esempio n. 13
0
         extern static int RegisterHotKey(IntPtr HWnd,  int ID,  MOD_KEY MOD_KEY,  Keys KEY);
Esempio n. 14
0
      /// <summary>
      /// ホットキーを指定して初期化する。
      /// 使用後は必ずDisposeすること。
      /// </summary>
      /// <param name="modKey">修飾キー</param>
      /// <param name="key">キー</param>
     public HotKey(MOD_KEY modKey,  Keys key)  
 {
             form  =  new HotKeyForm(modKey,  key,  raiseHotKeyPush);
         
 }
Esempio n. 15
0
 private static extern int RegisterHotKey(IntPtr hWnd, int id, MOD_KEY fsModifiers, Keys vk);
Esempio n. 16
0
 /// <summary>
 /// ホットキーを指定して初期化する。
 /// 使用後は必ずDisposeすること。
 /// </summary>
 /// <param name="modKey">修飾キー</param>
 /// <param name="key">キー</param>
 public HotKey(MOD_KEY modKey, Keys key)
 {
     form = new HotKeyForm(modKey, key, raiseHotKeyPush);
 }
Esempio n. 17
0
		public HotKeyRegister(MOD_KEY MOD_KEY, Keys key, WindowInteropHelper window)
			: this(MOD_KEY, key, window.Handle)
		{
		}
Esempio n. 18
0
		public HotKeyRegister(MOD_KEY MOD_KEY, Keys key, Window window)
			: this(MOD_KEY, key, new WindowInteropHelper(window))
		{
		}
Esempio n. 19
0
		public static extern bool RegisterHotKey(IntPtr hWnd, int id, MOD_KEY fsModifiers, Keys vk);
Esempio n. 20
0
 public HotKey(MOD_KEY modKey, Keys key, EventHandler handler)
 {
     form        = new HotKeyForm(modKey, key, raiseHotKeyPush);
     HotKeyPush += handler;
 }
Esempio n. 21
0
 public HotkeyData(Keys KeyCode, MOD_KEY ModKey)
 {
     this.KeyCode = KeyCode;
     this.ModKey  = ModKey;
 }
Esempio n. 22
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 public HotkeyData()
 {
     this.KeyCode = Keys.None;
     this.ModKey  = MOD_KEY.NONE;
 }
Esempio n. 23
0
 extern static int RegisterHotKey(IntPtr HWnd, int ID, MOD_KEY MOD_KEY, Keys KEY);
Esempio n. 24
0
 static extern int RegisterHotKey(IntPtr HWnd, int ID, MOD_KEY MOD_KEY, Keys KEY);
Esempio n. 25
0
 extern static int RegisterHotKey(IntPtr HWnd, int ID, MOD_KEY ModKey, int KEY);
Esempio n. 26
0
 /// <summary>
 /// ホットキーを指定して初期化する。
 /// 使用後は必ずDisposeすること。
 /// </summary>
 /// <param name="modKey">修飾キー</param>
 /// <param name="key">キー</param>
 public HotKey(MOD_KEY modKey, Keys key)
 {
     form = new HotKeyForm(modKey, key, raiseHotKeyPush);
 }
Esempio n. 27
0
 private static extern int RegisterHotKey(IntPtr HWnd, int ID, MOD_KEY MOD_KEY, Keys KEY);
Esempio n. 28
0
 public Hotkey(MOD_KEY ModKey, Keys Key)
 {
     Form = new HotkeyForm(ModKey, Key, RaiseHotkeyPush);
 }
Esempio n. 29
0
 /// <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);