The Wizard of Ogz
April 18th, 2005, 09:13 PM
Hello, everyone,
OK, here is what I'm trying to do. I open a flash game in IE or Firefox. The only input required to play the game is pressing the space bar to fire a cannon. I would like a program that automates pressing the space bar for me. I wrote a simple program that generates a keystroke in whatever window the mouse is over at a timed interval. It uses code like this:
POINT ptCursorPos;
GetCursorPos (&ptCursorPos);
HWND hwndMOver = WindowFromPoint (ptCursorPos);
SendMessage (hwndMOver, WM_KEYDOWN, VK_SPACE, 3735553);
SendMessage (hwndMOver, WM_CHAR, VK_SPACE, 3735553);
SendMessage (hwndMOver, WM_KEYUP, VK_SPACE, 3735553);
The Flash program accepts the "keystroke" at first, but once it reaches the main menu it doesn't respond to it. It does respond to an actual keystroke ( me pressing the space bar). I can't figure out why it would respond to that but not the messages my program is sending. Surely I don't understand something that is going on. I hope that one of you can explain it to me. Thanks.
OK, here is what I'm trying to do. I open a flash game in IE or Firefox. The only input required to play the game is pressing the space bar to fire a cannon. I would like a program that automates pressing the space bar for me. I wrote a simple program that generates a keystroke in whatever window the mouse is over at a timed interval. It uses code like this:
POINT ptCursorPos;
GetCursorPos (&ptCursorPos);
HWND hwndMOver = WindowFromPoint (ptCursorPos);
SendMessage (hwndMOver, WM_KEYDOWN, VK_SPACE, 3735553);
SendMessage (hwndMOver, WM_CHAR, VK_SPACE, 3735553);
SendMessage (hwndMOver, WM_KEYUP, VK_SPACE, 3735553);
The Flash program accepts the "keystroke" at first, but once it reaches the main menu it doesn't respond to it. It does respond to an actual keystroke ( me pressing the space bar). I can't figure out why it would respond to that but not the messages my program is sending. Surely I don't understand something that is going on. I hope that one of you can explain it to me. Thanks.