Get Async Key
Universidad Tecnológica De Puebla
Get Async Key
Objetivo:
Implementar la configuración deGet Async Key
Introducción:
Es un tipo de software o un dispositivo hardware específico que se encarga de registrar las pulsaciones que se realizan en el teclado, para posteriormente memorizarlasen un fichero o enviarlas a través de internet.
Desarrollo:
public partial class Form1 : Form
{
[DllImport("User32.dll")]
private static extern shortGetAsyncKeyState(System.Windows.Forms.Keys vKey);
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label lbl;
private System.Windows.Forms.Button cmdAsyncState;public Form1()
{
InitializeComponent();
}
private void Form1_KeyPress(object sender, KeyPressEventArgs e)
{
e.Handled = true;}
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
lbl.Text = "Key Down: " + e.KeyValue.ToString();
lbl.Text += "\nKey Code: " +e.KeyCode.ToString();
lbl.Text += "\nKey Data: " + e.KeyData.ToString();
if ((e.Modifiers & Keys.Shift) == Keys.Shift)
{
lbl.Text += "\n" + "tecla Shift";
}
if ((e.Modifiers & Keys.Control) == Keys.Control)
{
lbl.Text += "\n" + "tecla Control ";
}
if(e.Alt)
{
lbl.Text += "\n" + "tecla Alt ";
}
listBox1.Items.Add(lbl.Text);
}
private voidbutton1_Click(object sender, EventArgs e)
{
int state = Convert.ToInt32(GetAsyncKeyState(Keys.A).ToString());
switch (state)
{
case 0:...
Regístrate para leer el documento completo.