SendKeys() permission denied error in Visual Basic

后端 未结 9 1565
逝去的感伤
逝去的感伤 2021-01-11 11:14

I am trying to use the SendKeys() command to another window with my VB6 app.

What I wanted is to click a button, and then have 10 seconds to go to the o

9条回答
  •  天涯浪人
    2021-01-11 11:46

    Use this API:

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

    and

    keybd_event keycode, 0, 0, 0  'KEY DOWN
    keybd_event keycode, 0, KEYEVENTF_KEYUP, 0 'KEY UP
    

    when key code is 32 for space, 35 for keyend, 8 for vbKeyBack, etc.

提交回复
热议问题