Hi everybody,

I have been writing a windows console application in c#. I want it to read all keys pressed and write them all into a text file when a specific window is active in windows xp environment. Now, I can find the active window, but I failed to read keys entered when the intended window is active. ConsoleKey does not work..

Any recommendation?


Recommended Answers

All 13 Replies

No it wouldnt, however, this sounds distinctly like a keylogger which is unfair and illegal and bad practice in many ways, there are ways to do it, but, Id be interested in the business justification of it before parting with anything like how to start doing it

I understand LizR. However, this is must for my master-thesis :(

I need to store all messages during the chat sessions among users. And my solution is to store keyboard entries when the chat window of the intended program is active. I could not think of any other solution...

I appreciate any help..
Best Regards

>I need to store all messages during the chat sessions among users.
Is this some ad hoc chat program that doesn't support logging?

I can, but to be honest, your thesis doesnt make it a legal thing.

I'm trying to improve the intended tool with some complementary features. Currently and unfortunately, it does not support logging of chat sessions. And also its API does not provide such a capability.

If I could program what I want then I will do what is required for legacy.. Also I appreciate any help about legacy..

Thanks for your time..
So, what should I do?

As a side comment, Im not sure how logging an IM is going to ever form part of a thesis, however, surely writing a new IM that takes the current one and improves on it by adding the functionality you want is a far better use of all as users can then log, should they want, in a legal and healthy manner.

Actually, I like that idea, coding a new IM for the existing software tool, but I am not sure that my thesis-advisor will love it :(
And also, I am not sure I could write a new IM in a integration with the existing software... this is the other question in my mind.

LizR, as far as I understand, you absolutely did not suggest to save chat-session by reading keyboard, even if I find a way to obey legal issues.

Thaks a lot..
Best Regards..

When I searched through the internet with "c# keylogger" keyword, then it returns lots of results in official sites and forums.
I think its legal issues is related to your purposes. Once you've defined your problem statement and purpose for using keylogger application officially, then it is ok..

What is yours oppinion about that issue?
Best Regards.

>What is yours oppinion about that issue?
I think this is identical to discussion of writing a virus for instructional purposes. The direct intention may be benign, but ultimately it's so prone to being used illegally that Daniweb's rules come into play. Thus, discussion of keylogger implementation is prohibited.

Narue, do you mean keylogger implementation can not be used for any kind of scientific purposes?
What is the rule for using keylogger?

I mean this is a public forum, and we get wannabe hackers all the time. Regardless of your intentions, the chances of somebody taking the lessons from such a discussion and using them for illegal purposes are right at 100%.

In light of that (barring being overridden by happygeek or Dani), my official response is that you can debate legality all you want, but any discussion of implementing a keylogger on Daniweb would be a violation of Keep It Legal.

I wonder whether using a keylogger for my thesis reduces its quality, eventhough it helps to solve problem defined in the thesis.

Also do you know about good practices of using keylogger? Can you give some examples?


Id suggest finding a thesis project that is less contraversial.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.