Sending Fake Keystrokes to a Window in C# menu

Shout-Out

User Tag List

Results 1 to 9 of 9
  1. #1
    luciferc's Avatar Contributor
    Reputation
    90
    Join Date
    Jul 2008
    Posts
    373
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Sending Fake Keystrokes to a Window in C#

    So far i made the bot i wanted in crappy auto it. But i wanted for it to be in C#.

    So
    #1 i know the Keystroke API's don't work for Warhammer at least when i tryed them
    So what should i do ?

    Thanks for who ever responds : )
    Last edited by luciferc; 10-05-2008 at 09:20 AM.

    Sending Fake Keystrokes to a Window in C#
  2. #2
    Jens's Avatar Contributor
    Reputation
    179
    Join Date
    Sep 2006
    Posts
    251
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you tried PostMessage? because it works for me

  3. #3
    Pale's Avatar Active Member
    Reputation
    63
    Join Date
    Jun 2008
    Posts
    39
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Try the SendKeys

  4. #4
    Cephalopod's Avatar Member
    Reputation
    5
    Join Date
    Sep 2008
    Posts
    85
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Pale View Post
    Try the SendKeys
    I'd avoid using sendkeys, even if you only wanted to send to the active window I'd still avoid it and I would bring the window in question to the front (using SetForegroundWindow, and use the PostMessage API.

    From memory, warhammer only accepts keystrokes when it is the active (foreground) window. I might be wrong, but I remember reading this on multiboxing.com

  5. #5
    Apoc's Avatar Angry Penguin
    Reputation
    1388
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/13
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Midol View Post
    I'd avoid using sendkeys, even if you only wanted to send to the active window I'd still avoid it and I would bring the window in question to the front (using SetForegroundWindow, and use the PostMessage API.

    From memory, warhammer only accepts keystrokes when it is the active (foreground) window. I might be wrong, but I remember reading this on multiboxing.com
    That's not true. People are probably sending keystrokes to the wrong window handle. (Process.MainWindowHandle is NOT the one you should be sending to!)

    Also, use SendMessage if you can, PostMessage returns straight away and doesn't tell you whether the messaged was pumped into the other application properly or not. It's not quite reliable.

  6. #6
    Cephalopod's Avatar Member
    Reputation
    5
    Join Date
    Sep 2008
    Posts
    85
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Apoc View Post
    That's not true. People are probably sending keystrokes to the wrong window handle. (Process.MainWindowHandle is NOT the one you should be sending to!)

    Also, use SendMessage if you can, PostMessage returns straight away and doesn't tell you whether the messaged was pumped into the other application properly or not. It's not quite reliable.

    I've never looked into it, I only saw it on multiboxing.com so assumed it to be true, I don't play warhammer.

    When it comes to sending input commands, imo, postmessage is a far better option, this site has a paragraph which is similar to how I feel:
    PostMessage usually works better when you want to simulate a command or input event by posting WM_COMMAND or one of the keyboard or mouse messages (which is always dicey, by the way). This holds true because "real" input events usually come in sequences of related messages (such as keydown/keyup pairs) and your app may get befuddled if you try to process a new input message in the middle of one of these sequences. Post works better when simulating input.
    C++ Q&A: Sending Messages in Windows, Adding Hot Keys to your Application

  7. #7
    suicidity's Avatar Contributor
    Reputation
    207
    Join Date
    Oct 2006
    Posts
    1,439
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm working on a bot for WAR, and what worked for me is keybd_event and mapvirtualkey.


  8. #8
    Apoc's Avatar Angry Penguin
    Reputation
    1388
    Join Date
    Jan 2008
    Posts
    2,750
    Thanks G/R
    0/13
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by suicidity View Post
    I'm working on a bot for WAR, and what worked for me is keybd_event and mapvirtualkey.
    Isn't keybd_event a system wide keyboard hit? (I may be wrong, I don't use it for the fact that it's quite outdated.)

  9. #9
    suicidity's Avatar Contributor
    Reputation
    207
    Join Date
    Oct 2006
    Posts
    1,439
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, but unlike something like sendkeys; keybd_event will get to the WAR window, you just have to set the focus to the WAR window.

    It's a cheap way of going about it, I know; But I got tired of the mass fail attempts with SendInput.. Just needed a quick fix until I can work on it more later. But I do suggest SendInput if you can get it working Luciferc; SendInput over keybd_event of course, and then the best route would be what Apoc suggested above
    Last edited by suicidity; 01-11-2009 at 05:05 PM.


Similar Threads

  1. Worst that can happen with Sending Fake ID
    By Mask in forum World of Warcraft General
    Replies: 10
    Last Post: 07-13-2008, 01:18 PM
  2. Sending keystrokes to AoC window in background
    By Ghazban in forum Age of Conan Exploits|Hacks
    Replies: 1
    Last Post: 07-01-2008, 04:18 AM
  3. Freebie method for sending keys to multiple WoW windows
    By tomit12 in forum World of Warcraft Guides
    Replies: 6
    Last Post: 03-03-2008, 10:49 AM
All times are GMT -5. The time now is 12:28 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search