Visual Basic - Simular NUM LOCK con API?

Life is soft - evento anual de software empresarial
 
Vista:

Simular NUM LOCK con API?

Publicado por Pablin (19 intervenciones) el 14/07/2005 22:25:27
yo encontre un ejemplo que es...

Const VK_NUMLOCK = &H9
Const KEYEVENTF_EXTENDEDKEY = &H1
Const KEYEVENTF_KEYUP = &H2
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

'Simular que pulsamos la tecla
keybd_event VK_NUMLOCK, 0, 0, 0
'Simular que soltamos la tecla
keybd_event VK_NUMLOCK, 0, KEYEVENTF_KEYUP, 0

y eso funciona para la tecla TAB, alguien sabe como hacer que funcione para la tecla NUMLOCK, CAPSLOCK Y SCROLL LOCK? o aunque sea para alguna de esas tres?
Muchas gracias por la ayuda.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
sin imagen de perfil
Val: 14
Ha aumentado 1 puesto en Visual Basic (en relación al último mes)
Gráfica de Visual Basic

RE:Simular NUM LOCK con API?

Publicado por SuNcO (599 intervenciones) el 14/07/2005 22:28:53
Este es para el NumLock

En el formulario :

Private Sub Command1_Click()
SendNumLock
End Sub

En el modulo :

Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

Public Sub SendNumLock()

Const KEYEVENTF_EXTENDEDKEY = &H1
Const KEYEVENTF_KEYUP = &H2
Const VK_NUMLOCK = &H90

keybd_event VK_NUMLOCK, vbKeyNumlock, KEYEVENTF_EXTENDEDKEY Or 0, 0
keybd_event VK_NUMLOCK, vbKeyNumlock, KEYEVENTF_EXTENDEDKEY Or KEYEVENTF_KEYUP, 0

End Sub

Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar