예제 #1
0
파일: Form1.cs 프로젝트: rgcjonas/ppthotkey
        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;
            }
        }
예제 #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);
            }
        }