Foros del Web » Programación para mayores de 30 ;) » Programación General » Visual Basic clásico »

Ayuda con el Api...

Estas en el tema de Ayuda con el Api... en el foro de Visual Basic clásico en Foros del Web. hola uso la api de windows (keybd_event) para simular las pulsaciones del teclado pero cuando lo uso es como si las teclas que envie se ...
  #1 (permalink)  
Antiguo 13/09/2005, 08:47
 
Fecha de Ingreso: agosto-2005
Ubicación: Peru-Lima
Mensajes: 225
Antigüedad: 18 años, 8 meses
Puntos: 0
Ayuda con el Api...

hola
uso la api de windows (keybd_event) para simular las pulsaciones del teclado pero cuando lo uso es como si las teclas que envie se quedaran presionadas como hago para que no se queden presionadas?

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

keybd_event 50, 0, 0&, 0& '2
keybd_event 51, 0, 0&, 0& '3
keybd_event 49, 0, 0&, 0& '1

Gracias.
  #2 (permalink)  
Antiguo 13/09/2005, 10:17
Avatar de Andres95
Colaborador
 
Fecha de Ingreso: diciembre-2004
Mensajes: 1.802
Antigüedad: 19 años, 4 meses
Puntos: 38
The keybd_event function synthesizes a keystroke. The system can use such a synthesized keystroke to generate a WM_KEYUP or WM_KEYDOWN message. The keyboard driver's interrupt handler calls the keybd_event function.

VOID keybd_event(

BYTE bVk, // virtual-key code
BYTE bScan, // hardware scan code
DWORD dwFlags, // flags specifying various function options
DWORD dwExtraInfo // additional data associated with keystroke
);


Parameters

bVk

Specifies a virtual-key code. The code must be a value in the range 1 to 254.

bScan

Specifies a hardware scan code for the key.

dwFlags

A set of flag bits that specify various aspects of function operation. An application can use any combination of the following predefined constant values to set the flags:

Value Meaning
KEYEVENTF_EXTENDEDKEY If specified, the scan code was preceded by a prefix byte having the value 0xE0 (224).
KEYEVENTF_KEYUP If specified, the key is being released. If not specified, the key is being depressed.


dwExtraInfo

Specifies an additional 32-bit value associated with the key stroke.
  #3 (permalink)  
Antiguo 13/09/2005, 10:46
 
Fecha de Ingreso: agosto-2005
Ubicación: Peru-Lima
Mensajes: 225
Antigüedad: 18 años, 8 meses
Puntos: 0
Cita:
Iniciado por Andres95
The keybd_event function synthesizes a keystroke. The system can use such a synthesized keystroke to generate a WM_KEYUP or WM_KEYDOWN message. The keyboard driver's interrupt handler calls the keybd_event function.

VOID keybd_event(

BYTE bVk, // virtual-key code
BYTE bScan, // hardware scan code
DWORD dwFlags, // flags specifying various function options
DWORD dwExtraInfo // additional data associated with keystroke
);


Parameters

bVk

Specifies a virtual-key code. The code must be a value in the range 1 to 254.

bScan

Specifies a hardware scan code for the key.

dwFlags

A set of flag bits that specify various aspects of function operation. An application can use any combination of the following predefined constant values to set the flags:

Value Meaning
KEYEVENTF_EXTENDEDKEY If specified, the scan code was preceded by a prefix byte having the value 0xE0 (224).
KEYEVENTF_KEYUP If specified, the key is being released. If not specified, the key is being depressed.


dwExtraInfo

Specifies an additional 32-bit value associated with the key stroke.
NO ENTIENDO NADA ME PUEDES EXPLICAR MEJOR PLS
  #4 (permalink)  
Antiguo 13/09/2005, 10:51
Avatar de aldo1982  
Fecha de Ingreso: noviembre-2004
Ubicación: Santa Fe (Argentina) Colon F.C
Mensajes: 1.362
Antigüedad: 19 años, 5 meses
Puntos: 6
pero ke kilombrete ajajaj explicame ke keres hacer asi te puedo ayudar.
salu2
__________________
LA MUERTE ESTÁ TAN SEGURA DE VENCER QUE NOS DA TODA UNA VIDA DE VENTAJA
  #5 (permalink)  
Antiguo 13/09/2005, 11:09
 
Fecha de Ingreso: agosto-2005
Ubicación: Peru-Lima
Mensajes: 225
Antigüedad: 18 años, 8 meses
Puntos: 0
kiero enviar pulsaciones con la api de windows (keybd_event) envia las pulsaciones pero tengo un problema cada vez que envio una tecla se queda presionada : (
como puedo liberarlo?
  #6 (permalink)  
Antiguo 28/02/2008, 07:36
 
Fecha de Ingreso: febrero-2008
Mensajes: 1
Antigüedad: 16 años, 2 meses
Puntos: 0
Re: Ayuda con el Api...

Lo que quiere decir es que tenes q enviarla como liberando la tecla:
declara esta funcion

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

y para usarla

keybd_event 39, 0, 1&, 0&

eso por ejemplo envia un key stroke de arrow para la derecha, ya q el 39 es el "ascii" de esa tecla
lo q te queria decir el otro muchacho, es que le cambies el 0& por el 1&, como lo hice yo ahi arriba

Saludos
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta

SíEste tema le ha gustado a 1 personas (incluyéndote)




La zona horaria es GMT -6. Ahora son las 19:16.