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 : )
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.
you tried PostMessage? because it works for me![]()
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
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:
C++ Q&A: Sending Messages in Windows, Adding Hot Keys to your ApplicationPostMessage 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.
I'm working on a bot for WAR, and what worked for me is keybd_event and mapvirtualkey.
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.