Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to read keyboard when program is out of scope using C language?

 
Raju Felix
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
Please help me in How to read keyboard when program is out of scope using C.

Thanks,
 
Roger Sterling
Ranch Hand
Posts: 426
Eclipse IDE Fedora Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Raju - your question does not make sense. You want to read keyboard input when your program has already terminated ?
 
Raju Felix
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Roger Sterling,
No no, I just want to read the keys which are being pressed when the program is running only, but, Even when I work with another application (eg# a text editor, etc...) while my C program is running in background (i.e, console window is minimized) also, I want to read the keyboard.

Thanks,
 
fred rosenberger
lowercase baba
Bartender
Posts: 12085
29
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you want your program to be able to know what another program is doing? That sounds a little suspicious...
 
Luke Leber
Ranch Hand
Posts: 69
2
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This program is not necessarily suspicious. Many facilities (NIST and other government labs) implement such things on sensitive systems as a security measure. Case in point: It doesn't matter what the OP wants to know this information for.




This would require platform-specific constructs that standard C does not offer. Such an example would be implementing a keyboard hook (in Windows) http://msdn.microsoft.com/en-us/library/windows/desktop/ms644990%28v=vs.85%29.aspx

I'll leave the implementation details up to you as a learning experience.
 
Luke Leber
Ranch Hand
Posts: 69
2
C++ Linux Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roger Sterling wrote:Therefore, some of us refrain from helping answer a query if it appears like the use of the knowledge will be put to ill use.


Others can play judge in cases like this, but I will not lift myself up to the podium.

The best solution to "stop the evil" is to educate end-users about how to avoid exposing themselves to it and aiding system designers in patching security exploits exposed by the "evil".

Attempting to seal "the evil" behind bars is not a secure, or even a sensible solution.



Of course, we could just do like Sun / Oracle did and try to shroud vulnerabilities in a corporate hush, restricting as much dangerous information as possible, but I think we've all seen how that works out in the long-run...
 
Paul Clapham
Sheriff
Pie
Posts: 20750
30
Eclipse IDE Firefox Browser MySQL Database
  • Likes 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suspect most people who are trying to write keystroke loggers and have to post here to ask how aren't aspiring malware writers. After all you can download one from the net after searching for less than a minute, so why bother to write your own? It's more likely that the people asking the question here think they are going to learn something useful from the exercise.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic