Exemple #1
0
        public Form1(KeyboardHooker hooker)
        {
            InitializeComponent();

            hooker.KeyIntercepted += new KeyboardHooker.KeyInterceptedHandler(hooker_KeyIntercepted);

            if (hooker.ErrorCode == 0)
            {
                this.lblKeyboardHookStatus.Text      = "OK";
                this.lblKeyboardHookStatus.ForeColor = Color.Green;
            }
            else
            {
                this.lblKeyboardHookStatus.Text      = string.Format("Fehler 0x{0:X}", hooker.ErrorCode);
                this.lblKeyboardHookStatus.ForeColor = Color.Red;
            }
        }
Exemple #2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            try
            {
                using (var h = new KeyboardHooker())
                {
                    Application.Run(new Form1(h));
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "PPT Hotkey Error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
            }
        }