fake input , cant understand ~.~
-
I want to make a program which do a fake input. It sounds a foolish program, but I want to make it for a special purpose. I run an application (ex. a game like Age of Empire, Starcraft, so on). And then I run my program. My program create a window (use CreateWindowEx()), and now, I want anything I do on this window will do on that application (I move the mouse, the mouse(pointer) in that application move, I click the mouse, the mouse in that application click, ...). I tried to get a handle of that application and send message to it (use FindWindowEx() and SendMessage() ) but nothing happened. I also tried SendInput() and AttachThreadInput(), but I failed too. It may be really foolish, but my program need to do a task like it. Could you help me solve this problem ? -- modified at 4:38 Wednesday 18th January, 2006
-
I want to make a program which do a fake input. It sounds a foolish program, but I want to make it for a special purpose. I run an application (ex. a game like Age of Empire, Starcraft, so on). And then I run my program. My program create a window (use CreateWindowEx()), and now, I want anything I do on this window will do on that application (I move the mouse, the mouse(pointer) in that application move, I click the mouse, the mouse in that application click, ...). I tried to get a handle of that application and send message to it (use FindWindowEx() and SendMessage() ) but nothing happened. I also tried SendInput() and AttachThreadInput(), but I failed too. It may be really foolish, but my program need to do a task like it. Could you help me solve this problem ? -- modified at 4:38 Wednesday 18th January, 2006
i dont know the exact solution, the games like these use directinput, it is part of the DirectX package.
-Prakash
-
i dont know the exact solution, the games like these use directinput, it is part of the DirectX package.
-Prakash
-
The game is not very important, I mean any application, such as Notepad, Paint, Wordpad ....
Didn't it work as I suggested sometime back.
Jesus Loves:rose:
--Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:
-
Didn't it work as I suggested sometime back.
Jesus Loves:rose:
--Owner Drawn:rose: --Nothing special --Defeat is temporary but surrender is permanent --Never say quits --Jesus is Lord:rose:
It didnt work at all. I'm sure send message which use SendMessage successfully ( try WM_CLOSE and it worked). But if try to send message WM_MOUSEMOVE, WM_LBUTTONDOWN or WM_KEYDOWN nothing happen. I used Spy++ and did a copy, but nothing happened. That's why I cant understand.
-
I want to make a program which do a fake input. It sounds a foolish program, but I want to make it for a special purpose. I run an application (ex. a game like Age of Empire, Starcraft, so on). And then I run my program. My program create a window (use CreateWindowEx()), and now, I want anything I do on this window will do on that application (I move the mouse, the mouse(pointer) in that application move, I click the mouse, the mouse in that application click, ...). I tried to get a handle of that application and send message to it (use FindWindowEx() and SendMessage() ) but nothing happened. I also tried SendInput() and AttachThreadInput(), but I failed too. It may be really foolish, but my program need to do a task like it. Could you help me solve this problem ? -- modified at 4:38 Wednesday 18th January, 2006
I feel like I've answered this question at least three times but here we go again. Faking input using the
PostMessage
orPostMessage
API is a hit and miss affair - It will work for some applications and not so well, if at all, with others. The reason is that there is more information associated with a message other then theHWND
, the message, theWPARAM
and theLPARAM
. To access this extra information you use APIs such asGetMessagePos
andGetMessageTime
. Then there is software that calls functions such asGetAsyncKeyState
(this also works for mouse buttons). This is the reason for theSendInput
API - This is what you use to fake input - Unless you're faking for a particular app and you know the message techniques work. If the application uses DirectInput I'm not sure how you would proceed and if theSendInput
will work. This would probably only be an issue for games. Steve -
I want to make a program which do a fake input. It sounds a foolish program, but I want to make it for a special purpose. I run an application (ex. a game like Age of Empire, Starcraft, so on). And then I run my program. My program create a window (use CreateWindowEx()), and now, I want anything I do on this window will do on that application (I move the mouse, the mouse(pointer) in that application move, I click the mouse, the mouse in that application click, ...). I tried to get a handle of that application and send message to it (use FindWindowEx() and SendMessage() ) but nothing happened. I also tried SendInput() and AttachThreadInput(), but I failed too. It may be really foolish, but my program need to do a task like it. Could you help me solve this problem ? -- modified at 4:38 Wednesday 18th January, 2006
I'm not sure on the details but this site has something to say (and something to offer) on DirectInput and faking input. Steve