I want to be able to send actual keystokes to a application. Certain programs
can detect that I am using Sendkeys and block the strokes.
Is there anyway inwhich I can send an actual key stoke via API as though
their is an actual person present pressing the keys?
Thanks
--
Anthony Prescott
http://www.apofficesolutions.co.uk
Message posted via VBMonster.com
http://www.vbmonster.com/Uwe/Forums.aspx/vb-syntax/200904/1
> I want to be able to send actual keystokes to a application. Certain
> programs
> can detect that I am using Sendkeys and block the strokes.
>
> Is there anyway inwhich I can send an actual key stoke via API as though
> their is an actual person present pressing the keys?
Look up the keybd_event() API function.
I have done this and it works fine, I have put this here as an example for
anyone who is looking to do the same:
Private Declare Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal
bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Const KEYEVENTF_KEYUP = &H2
Private Const VK_LSHIFT = &HA0 ' Left SHIFT
Private Const VK_RSHIFT = &HA1 ' Right SHIFT
Private Const VK_LCONTROL = &HA2 ' Left CTRL
Private Const VK_RCONTROL = &HA3 ' Rght CTRL
Private Const VK_0 = 48
Private Const VK_1 = 49
Private Const VK_2 = 50
Private Const VK_3 = 51
Private Const VK_4 = 52
Private Const VK_5 = 53
Private Const VK_6 = 54
Private Const VK_7 = 55
Private Const VK_8 = 56
Private Const VK_9 = 57
Private Const VK_a = 65
Private Const VK_b = 66
Private Const VK_c = 67
Private Const VK_d = 68
Private Const VK_e = 69
Private Const VK_f = 70
Private Const VK_g = 71
Private Const VK_h = 72
Private Const VK_i = 73
Private Const VK_j = 74
Private Const VK_k = 75
Private Const VK_l = 76
Private Const VK_m = 77
Private Const VK_n = 78
Private Const VK_o = 79
Private Const VK_p = 80
Private Const VK_q = 81
Private Const VK_r = 82
Private Const VK_s = 83
Private Const VK_t = 84
Private Const VK_u = 85
Private Const VK_v = 86
Private Const VK_w = 87
Private Const VK_x = 88
Private Const VK_y = 89
Private Const VK_z = 90
Function PressKeys()
keybd_event VK_a, 0, 0, 0 'Press A key
keybd_event VK_b, 0, 0, 0 'Press B key
keybd_event VK_c, 0, 0, 0 'Press C key
End Function
Regards
CrowBar
--
Anthony Prescott
http://www.apofficesolutions.co.uk
Message posted via VBMonster.com
http://www.vbmonster.com/Uwe/Forums.aspx/vb-syntax/200907/1