Win32, Hook Functions, Message Pump...

This is a discussion on Win32, Hook Functions, Message Pump... within the C++ Programming forums, part of the General Programming Boards category; Im trying to make a program that simulates mouse and key presses so that any program that has the focus ...

  1. #1
    Codebot
    Join Date
    Jun 2004
    Location
    Toronto
    Posts
    195

    Win32, Hook Functions, Message Pump...

    Im trying to make a program that simulates mouse and key presses so that any program that has the focus gets those key/mouse presses.

    Im thinking of pushing simulated key presses into the windows message pump, but i dont know how to do that.

    Can any of you guys point me to any tutorials, examples, or books that have this information.

  2. #2
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    I was looking at something similar a while ago to throw a console window into fullscreen but didn't turn up much information. I'd just google for a few phrases - see what you turn up.
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

  3. #3
    Registered User
    Join Date
    Jan 2006
    Location
    Washington D.C.
    Posts
    25
    http://msdn.microsoft.com/library/de...eybd_event.asp

    keybd_event function may be of some use to you (assuming you use windows).

  4. #4
    Codebot
    Join Date
    Jun 2004
    Location
    Toronto
    Posts
    195
    Yes im using windows.

    This might be good for the keyboard events, but Im also interested in synthisizing mouse movements, clicks, etc.

  5. #5
    int x = *((int *) NULL); Cactus_Hugger's Avatar
    Join Date
    Jul 2003
    Location
    Banks of the River Styx
    Posts
    902
    guyonasm sent you a link to keybd_event, for keyboard input... now, for mouse input, look up... (drumroll) "mouse_event"

    Though personally, I've never used either. While I've never simulated mouse input, I have done keyboard, but I did it by sending WM_CHAR messages to the target window. (Though this might be application dependant, I don't know...)
    long time; /* know C? */
    Unprecedented performance: Nothing ever ran this slow before.
    Any sufficiently advanced bug is indistinguishable from a feature.
    Real Programmers confuse Halloween and Christmas, because dec 25 == oct 31.
    The best way to accelerate an IBM is at 9.8 m/s/s.
    recursion (re - cur' - zhun) n. 1. (see recursion)

  6. #6
    Codebot
    Join Date
    Jun 2004
    Location
    Toronto
    Posts
    195
    Thanks guys, this helps alot.

    I have one question tho. when simulating a mouse/keyboard will DirectInput get these messages aswell? Because i do know directInput gets its input a little differently then the regular message pump.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Win32 Console Functions
    By SirCrono6 in forum C++ Programming
    Replies: 0
    Last Post: 03-31-2005, 11:00 PM
  2. Middle button mouse capture in another program
    By Gayak in forum Windows Programming
    Replies: 5
    Last Post: 06-13-2002, 06:00 PM
  3. Tab Controls - API
    By -KEN- in forum Windows Programming
    Replies: 7
    Last Post: 06-02-2002, 10:44 AM
  4. Help with Direct X and Win32......:D
    By incognito in forum Windows Programming
    Replies: 1
    Last Post: 04-16-2002, 08:59 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21