示例#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;
         }
     }
 }
示例#2
0
文件: HotKey.cs 项目: cignoir/KinecTh
 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;
         }
     }
 }
示例#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;
                             
         }
                     
     }
             
 }
示例#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;
         }
     }
 }
示例#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;
		}
示例#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;
		}
示例#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);
 }
示例#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);
        }
示例#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;
    }
示例#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);
        }
示例#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);
        }
示例#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);
 }
示例#13
0
         extern static int RegisterHotKey(IntPtr HWnd,  int ID,  MOD_KEY MOD_KEY,  Keys KEY);
示例#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);
         
 }
示例#15
0
 private static extern int RegisterHotKey(IntPtr hWnd, int id, MOD_KEY fsModifiers, Keys vk);
示例#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);
 }
示例#17
0
		public HotKeyRegister(MOD_KEY MOD_KEY, Keys key, WindowInteropHelper window)
			: this(MOD_KEY, key, window.Handle)
		{
		}
示例#18
0
		public HotKeyRegister(MOD_KEY MOD_KEY, Keys key, Window window)
			: this(MOD_KEY, key, new WindowInteropHelper(window))
		{
		}
示例#19
0
		public static extern bool RegisterHotKey(IntPtr hWnd, int id, MOD_KEY fsModifiers, Keys vk);
示例#20
0
 public HotKey(MOD_KEY modKey, Keys key, EventHandler handler)
 {
     form        = new HotKeyForm(modKey, key, raiseHotKeyPush);
     HotKeyPush += handler;
 }
示例#21
0
 public HotkeyData(Keys KeyCode, MOD_KEY ModKey)
 {
     this.KeyCode = KeyCode;
     this.ModKey  = ModKey;
 }
示例#22
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 public HotkeyData()
 {
     this.KeyCode = Keys.None;
     this.ModKey  = MOD_KEY.NONE;
 }
示例#23
0
 extern static int RegisterHotKey(IntPtr HWnd, int ID, MOD_KEY MOD_KEY, Keys KEY);
示例#24
0
 static extern int RegisterHotKey(IntPtr HWnd, int ID, MOD_KEY MOD_KEY, Keys KEY);
示例#25
0
 extern static int RegisterHotKey(IntPtr HWnd, int ID, MOD_KEY ModKey, int KEY);
示例#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);
 }
示例#27
0
 private static extern int RegisterHotKey(IntPtr HWnd, int ID, MOD_KEY MOD_KEY, Keys KEY);
示例#28
0
 public Hotkey(MOD_KEY ModKey, Keys Key)
 {
     Form = new HotkeyForm(ModKey, Key, RaiseHotkeyPush);
 }
示例#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);