how simulate keyboard and mouse whilst in game?
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: how simulate keyboard and mouse whilst in game?

Hybrid View

  1. #1
    Join Date
    Apr 2011
    Location
    England
    Posts
    14

    how simulate keyboard and mouse whilst in game?

    hi i am trying to make a program that whilst ingame (magicka if anyone is interested) reads what is pressed on the keyboard and the simulates a combination of keyboard key down and keyboar key up and mouse press.

    eg if i press NumPad0 it would simulate Key Press A, Key Press S, Key Press F

    or if i press NumPad1 it would simulate Shift Down, LButton Press, Shift Up

    i have already managed to read what is pressed on the keyboard and know just need to know how to simulate pressing my combination

    i have read about DirectX's SendInput and other stuff but was wondering what is the best way to do this so the game will read what inputs i have pressed? and also if anyone has any good tutorials/help sites they can link me to!

    Thanks in advance =)
    Ollie

  2. #2
    Join Date
    Jun 2008
    Posts
    2,477

    Re: how simulate keyboard and mouse whilst in game?

    Sooo... you're trying to create a bot? How do the game developers feel about that?

  3. #3
    Join Date
    Apr 2011
    Location
    England
    Posts
    14

    Re: how simulate keyboard and mouse whilst in game?

    well i dont really no what a bot is as i never use them, but im not here to cheat. all im looking to do is make some hotkeys so i can cast my spells quicker. the game is a co-op online, no versus, so it's not hindering anyone else.

    please can you help me?

  4. #4
    Join Date
    Jun 2008
    Posts
    2,477

    Re: how simulate keyboard and mouse whilst in game?

    Well, you could probably get away with using an existing (and totally awesome) tool like AutoHotKey. This program does the work for you and already knows how to hook into Windows keyboard events. You can create macros for whatever you like with it.

  5. #5
    Join Date
    Apr 2011
    Location
    England
    Posts
    14

    Re: how simulate keyboard and mouse whilst in game?

    okay thanks for that but part of this is to improve/keep up my programming skills! if i give up on this project i will defo use that, thanks!! =)

  6. #6
    Join Date
    Jun 2008
    Posts
    2,477

    Re: how simulate keyboard and mouse whilst in game?

    Ok, then you need to learn the Windows API, specifically how keyboard hooks work. There are countless articles on the subject all over the net already.

  7. #7
    Join Date
    Apr 2011
    Location
    England
    Posts
    14

    Re: how simulate keyboard and mouse whilst in game?

    Yer I have seen loads of articles on it aswel! I was not really asking how to do it but what is the best way to do it as i have also read that people didn't find certain ways didn't work with directx! So will Windows API and keyboard hooks work with directx?

    Thanks Ollie
    Last edited by geekman92; May 2nd, 2011 at 11:59 PM. Reason: typo

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center