How to receive input?

Posts 1–13 of 13 · Page 1 of 1
How to receive input?
I have a command prompt application that opens certain programs and waits for certain input.

Lets say it opens Firefox, how can I make my application still receive input without having to switch over to my application
Does that still work even though my program isnt the main window I am working on? Lets say I am using Firefox, would it still receive everything I type?
Quote Originally Posted by mmbob View Post
Your best bet would be SetWindowsHookEx with a WH_KEYBOARD hook.
dont complicate.

Yes GetAsyncKeyState will work without anykind of focus to the window.
Ok, thankyou
Quote Originally Posted by 'Bruno View Post
dont complicate.

Yes GetAsyncKeyState will work without anykind of focus to the window.
The thing is with GAKS he has to check for each key being pressed, taking forever
[highlight=c++]for(int i = 0; i < 255; i++)
{
if(GetAsyncKeyState(i))
{
//Do some shit here
}
}[/highlight]
Not really efficient to keep calling GetAsyncKeyState in an endless for/while loop (no to mention the fact that another apps can get the recently pressed bit instead of yours). Even if you were to stick that in a thread it'd be plain ugly -

If you're wanting to log everything My vote goes for the hook (hell, I think I even made a post about a keyboard hook ages ago..)

Edit: yeah here ya go: http://www.mpgh.net/forum/31-c-c/948...rd-hook-c.html
That sample basically checks for a certain key press (page Up in this case) and does 'something'

Or something similar (full blown keyboard logger) in asm http://www.mpgh.net/forum/34-assembl...kb-logger.html
Thank you lord for sending back B1ackAnge1. It is a great honor for us to have him back in our sections.

In the name of Father, Son and the holy bullshit thingie, Amen.
Quote Originally Posted by Hell_Demon View Post
Thank you lord for sending back B1ackAnge1. It is a great honor for us to have him back in our sections.

In the name of Father, Son and the holy bullshit thingie, Amen.
Amen. Lord Jesus. Amen.
hahah you guys crack me up - Nice to see you guys too
Quote Originally Posted by Hell_Demon View Post
Thank you lord for sending back B1ackAnge1. It is a great honor for us to have him back in our sections.

In the name of Father, Son and the holy bullshit thingie, Amen.
Quote Originally Posted by why06 View Post


Amen. Lord Jesus. Amen.
Who's this B1ackAnge1? :/

Quote Originally Posted by B1ackAnge1 View Post
hahah you guys crack me up - Nice to see you guys too ;)
hello :)
Posts 1–13 of 13 · Page 1 of 1

Post a Reply

Tags for this Thread

None

Talk with us