using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.Runtime.InteropServices; using Utilities; namespace key_preview { public partial class Form1 : Form { globalKeyboardHook gkh = new globalKeyboardHook(); public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { gkh.HookedKeys.Add(Keys.A); gkh.HookedKeys.Add(Keys.B); gkh.HookedKeys.Add(Keys.C); gkh.KeyDown += new KeyEventHandler(gkh_KeyDown); gkh.KeyUp += new KeyEventHandler(gkh_KeyUp); } void gkh_KeyUp(object sender, KeyEventArgs e) { if ( e.KeyCode == Keys.A) { SendKeys.Send("c"); } if (e.KeyCode == Keys.C) { SendKeys.Send ("b"); } if (e.KeyCode == Keys.B) { SendKeys.Send("a"); } e.Handled = true; } void gkh_KeyDown(object sender, KeyEventArgs e) { e.Handled = true; } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)