giu 16

[VB6] Realizzare un KEYSENDER

Ecco come inviare/simulare tasti dal programma con visual basic 6

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

Read the rest of this entry »

giu 14

[VB6] Simulazione tasto Windows (Start)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Const KEYEVENTF_KEYUP = &H2

Private Sub Form_Load()
' simula la pressione dei tasti Ctrl-Esc
keybd_event vbKeyControl, 0, 0, 0
keybd_event vbKeyEscape, 0, 0, 0
DoEvents

' simula il rilascio dei due tasti
keybd_event vbKeyControl, 0, KEYEVENTF_KEYUP, 0
keybd_event vbKeyEscape, 0, KEYEVENTF_KEYUP, 0
DoEvents

End Sub