none
Why doesn't this keyboard button simulation work in games? RRS feed

  • Question

  • This keyboard key simulation works in Notepad.

    Why doesn't this keyboard button simulation work in games?

    Const vk_forward As UInteger = &H57 'w
    <DllImport("user32.dll")>
    Private Shared Sub keybd_event(ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As UInteger, ByVal dwExtraInfo As Integer)
    End Sub
    
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If Keyboard.IsKeyDown(System.Windows.Input.Key.LeftShift) = True Then keybd_event(vk_forward, 0, 0, 0)
    
    End Sub

    Friday, February 21, 2020 4:03 PM

All replies

  • It depends on games

    For some, you need to be Admin (with manifest for example)

    Some other games are protected by GameGuard


    • Edited by Castorix31 Friday, February 21, 2020 4:12 PM
    Friday, February 21, 2020 4:11 PM
  • How to avoid GameGuard?
    Friday, February 21, 2020 5:03 PM
  • Hi Saulius LT,

    If you want to avoid GameGuard, you will probably need Visual C++ and other tools to do it.

    For more information about it, you can search online: 'Bypass GameGuard'.

    Besides, I find a reference related to Keyboard simulation does not work for game, you can convert the code to VB.

    Hope it can help you.

    Best Regards,

    Xingyu Zhao


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.


    Monday, February 24, 2020 3:37 AM
    Moderator