-
March 24th, 2012, 07:58 AM
#1
Simulate keypress
Hi,
I'm programming under WindowsXP, VS, C++.
I would like to ask you, if there is any possibility of simulating keypress through assembler?
I've read lots of stuff on the net, but didn't found any code. I've heard of something like INT16 interrupt, but never wrote any code in assembler. (Just some stupid /add/ calls)
__asm {
...? ;want to do a keypress here, but how?
}
The reason why I need to use assembler calls is that keyb_event() function is being ignored by GameGuards (or maybe it's because of DirectInput in games?).
Please, give me some hints. Can't sleep before I'm done
-
March 27th, 2012, 05:38 AM
#2
Re: Simulate keypress
I guess calling int 16h interrupt won't work on 32 bit system/compiler.
Is there any way around to do the 16h interrupt under VS? I'm thinking also about the MASM compiler and writing my windows hook there.
Or maybe there is another way to simulate keypress on the lowest possible level?
-
March 27th, 2012, 11:01 AM
#3
Re: Simulate keypress
It might be as you say that DirectInput gets the input earlier in the chain but have you tried SendInput? http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx
-
March 27th, 2012, 12:03 PM
#4
Re: Simulate keypress
I agree to S_M_A that hooking actually may not even be required here and would have thought of somthing like SendInput() in the first place too.
Also, provided you actually need hooking, that can be done pretty well in C++ without the need to use assembly language at all. If, however, for some reason you really want assembly language, here's a thread discussing recording and playback of keystrokes using jounal hooks in assembly language: http://forums.codeguru.com/showthread.php?t=513274. The Windows programms in there are pure assembly language without any C or C++ components, but at least they should illustrate the underlying idea.
As to INT 16h, if that is of any use under 32-bit Windows at all, it would at best be useful for keyboard drivers. But actually, I think, not even those can use it in a reasonable way since it's legacy 16-bit stuff. And, for completeness, note that in order to simulate keystrokes you wouldn't call that interrupt, instead you would override it, which actually is somewhat similar to Windows hooks.
I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.
This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|