0

Let's say I was using cin in my program to allow the user to input into the console. That is simple enough but what if they were typing into, let's say, a web browser and I wanted them to input that into the console at the same time? When I click away the C++ program console window and have something else on top, the input obviously does not go into the console. How can I make it so the console is always running on top so that even when I were to input something into a web browser, it would also go into the console?

aanrv
  • 2,159
  • 5
  • 25
  • 37
  • So you're writing a keylogger designed to steal passwords typed into the browser, right? – Steve Jessop Oct 06 '13 at 18:55
  • @SteveJessop If I was just another guy wanting to hack things to impress his friends, I could have gone on youtube and watched any of the hundreds of tutorials on making a keylogger. I asked this question to develop my understanding of the ways of console input (and output). – aanrv Oct 06 '13 at 19:06
  • 1
    on top of what? On what operating system? – bmargulies Oct 06 '13 at 19:11
  • **Please change the title** - it is off-topic for the actuall question and answers... if you are really looking for **CONSOLE APP ALWAYS ON TOP? => check my question:** http://stackoverflow.com/questions/27068650/c-console-application-always-on-top – jave.web Nov 22 '14 at 10:17

2 Answers2

0

I think you may want to take a look at hooking the keyboard to get the input?

Rivasa
  • 6,510
  • 3
  • 35
  • 64
0

in order capture keyboard input when your application is not focused, you need to use windows hook, see:

http://msdn.microsoft.com/en-us/library/ms644959%28v=vs.85%29.aspx#wh_keyboardhook

Example code can be found here:

http://www.codeguru.com/cpp/w-p/system/keyboard/article.php/c5699/Hooking-the-Keyboard.htm

sara
  • 3,824
  • 9
  • 43
  • 71