Visual Basic - Simular teclado URGENTEE!!

Life is soft - evento anual de software empresarial
 
Vista:

Simular teclado URGENTEE!!

Publicado por Juan Manuel (124 intervenciones) el 18/02/2004 18:00:55
Hola ....
Necesito saber como simular que se presionan teclas en el teclado para automatizar tareas, y si estas "teclas presionadas" pueden hacer efecto en un programa que corre en la ventana de DOS

Probe con el sendkeys pero no hace eso

Muchas Gracias
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

RE:Simular teclado URGENTEE!!

Publicado por Cecilia Colalongo (3116 intervenciones) el 18/02/2004 18:26:49
Deberías utilizar BringWindowToTop para pasar la ventana de DOS hacia adelante y luego, keybd_event, por ejemplo:

lngHwnd = FindWindow("ConsoleWindowClass", "Command Prompt")

BringWindowToTop lngHwnd

strProv = "VER"

For i = 1 To Len(strProv)
keybd_event Asc(Mid(strProv, i, 1)), 0, 0, 0
keybd_event Asc(Mid(strProv, i, 1)), 0, KEYEVENTF_KEYUP, 0
Next i

keybd_event 13, 0, 0, 0
keybd_event 13, 0, KEYEVENTF_KEYUP, 0

Las funciones son:

Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long

Public Declare Function BringWindowToTop Lib "user32" Alias "BringWindowToTop" (ByVal hwnd As Long) As Long

Public Declare Sub keybd_event Lib "user32" Alias "keybd_event" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
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