Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

310
Views
Presione programáticamente la tecla "Shift derecho"

Tengo problemas para encontrar una manera de presionar específicamente una tecla de mayúsculas a la derecha mediante programación. Necesito una sola tecla hacia abajo y hacia arriba (presionar/soltar).

lo que tengo es:

 SendKeys.Send("{RSHIFT}")

Y sé que ese cambio es como:

 SendKeys.Send("+")

Supongo que es solo la tecla de mayúsculas, pero necesito específicamente una tecla de mayúsculas a la derecha.

¿Podría alguien, por favor, ayudarme con este código?

over 4 years ago · Santiago Trujillo
2 answers
Answer question

0

Encontré esto después de algunas combinaciones creativas de palabras clave

Se reduce a esto para enviar códigos clave:

 Keys key = Keys.RShiftKey;//Right shift key SendMessage(Process.GetCurrentProcess().MainWindowHandle, WM_KEYDOWN, (int)key, 1);

No sé cuál es el caso de uso aquí, pero tenga en cuenta el parámetro de identificador de ventana que se pasa: Process.GetCurrentProcess().MainWindowHandle .

Esto envía la pulsación de tecla a sí mismo. Si está intentando enviarlo a otro proceso/programa, deberá pasar el identificador de ventana para ese programa.

over 4 years ago · Santiago Trujillo Report

0

Usando keybd_event no necesita el identificador de ventana

VB:

 Public Class MyKeyPress <DllImport("user32.dll", CharSet:=CharSet.Auto, CallingConvention:=CallingConvention.StdCall)> Public Shared Sub keybd_event(ByVal bVk As UInteger, ByVal bScan As UInteger, ByVal dwFlags As UInteger, ByVal dwExtraInfo As UInteger) End Sub ' To find other keycodes check bellow link ' http://www.kbdedit.com/manual/low_level_vk_list.html Public Shared Sub Send(key As Keys) Select Case key Case Keys.A keybd_event(&H41, 0, 0, 0) Case Keys.Left keybd_event(&H25, 0, 0, 0) Case Keys.LShiftKey keybd_event(&HA0, 0, 0, 0) Case Keys.RShiftKey keybd_event(&HA1, 0, 0, 0) Case Else Throw New NotImplementedException() End Select End Sub End Class

C#:

 public static class MyKeyPress { [DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)] public static extern void keybd_event(uint bVk, uint bScan, uint dwFlags, uint dwExtraInfo); // To get other key codes check bellow link // http://www.kbdedit.com/manual/low_level_vk_list.html public static void Send(Keys key) { switch (key) { case Keys.A: keybd_event(0x41, 0, 0, 0); break; case Keys.Left: keybd_event(0x25, 0, 0, 0); break; case Keys.LShiftKey: keybd_event(0xA0, 0, 0, 0); break; case Keys.RShiftKey: keybd_event(0xA1, 0, 0, 0); break; default: throw new NotImplementedException(); } } }

uso:

 MyKeyPress.Send(Keys.LShiftKey)
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!