473,387 Members | 1,453 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How can I capture a keypress in a windows service?

I know how to capture a keypress for a windows application, but how would I
go about doing it for a windows service?

Rather than having a form in focus all the time, I would prefer to have
something running in the background. There are option such as having the
form invisible (opacity set to zero) and settings it's location as -200, -200
so that it isn't on the screen, but this isn't the ideal solution.
Mar 19 '07 #1
4 13020
What is the effect you are trying to achieve. You cannot show a form from a
service but you might not want a service, you might be interested in a
notfify icon
--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com
"cashdeskmac" wrote:
I know how to capture a keypress for a windows application, but how would I
go about doing it for a windows service?

Rather than having a form in focus all the time, I would prefer to have
something running in the background. There are option such as having the
form invisible (opacity set to zero) and settings it's location as -200, -200
so that it isn't on the screen, but this isn't the ideal solution.
Mar 19 '07 #2
Basically I am trying to create a crude keylogger application. I didn't want
to show a form from the Windows service (using a Windows form was an
alternative option, and although it works, it is not the ideal way to capture
all key strokes).

I would rather have the windows service running in the background from the
moment the computer starts to the moment is closes down.

I realise that there are free keyloggers available on the web but I would
like to add my own functionality.

"Ciaran O''Donnell" wrote:
What is the effect you are trying to achieve. You cannot show a form from a
service but you might not want a service, you might be interested in a
notfify icon
--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com
"cashdeskmac" wrote:
I know how to capture a keypress for a windows application, but how would I
go about doing it for a windows service?

Rather than having a form in focus all the time, I would prefer to have
something running in the background. There are option such as having the
form invisible (opacity set to zero) and settings it's location as -200, -200
so that it isn't on the screen, but this isn't the ideal solution.
Mar 19 '07 #3
Ciaran,

A service in this case is not the correct solution. A service is not
aware of the currently logged on session, as there could be no current
session, or multiple sessions.

What you want to do is have a program run when the user logs on, and
then have that insert a windows hook which will capture the keystrokes.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"cashdeskmac" <ca*********@discussions.microsoft.comwrote in message
news:20**********************************@microsof t.com...
Basically I am trying to create a crude keylogger application. I didn't
want
to show a form from the Windows service (using a Windows form was an
alternative option, and although it works, it is not the ideal way to
capture
all key strokes).

I would rather have the windows service running in the background from the
moment the computer starts to the moment is closes down.

I realise that there are free keyloggers available on the web but I would
like to add my own functionality.

"Ciaran O''Donnell" wrote:
>What is the effect you are trying to achieve. You cannot show a form from
a
service but you might not want a service, you might be interested in a
notfify icon
--
Ciaran O''Donnell
http://wannabedeveloper.spaces.live.com
"cashdeskmac" wrote:
I know how to capture a keypress for a windows application, but how
would I
go about doing it for a windows service?

Rather than having a form in focus all the time, I would prefer to have
something running in the background. There are option such as having
the
form invisible (opacity set to zero) and settings it's location
as -200, -200
so that it isn't on the screen, but this isn't the ideal solution.

Mar 19 '07 #4
Goodluck with writing your keylogger. The windows api for this is
hellish (also it only runs in unmanaged code)... personally I think
you should buy a commercial application. However, follow that link it
has some great examples of viewing keypress events in C# ( and
suppressing them ). Also capturing CTRL+ALT+DEL and passwords is a
whole different ballgame but that link does support it.

http://www.dwinlock.kassl.de/

-James

Mar 19 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Madestro | last post by:
Hi guys, I have a little problem. I have a class that uses Windows API to capture a snapshot of the screen. I have this class in a library that I include in my projects. When I try to use...
9
by: SP | last post by:
Hi All, I wrote a windows service which is supposed to stop after specified amount of time. I am calling OnStop() after specified time. OnStop() methods executed but I dont see the service...
0
by: pithhelmet | last post by:
Hello everyone - I need to create a windows service that will watch for a specific dialog, and when found, send a keypress to the dialog. I have the service working, but when it tries to find...
5
by: OpticTygre | last post by:
What is the best way that anyone has found to capture errors inside a windows service? It's pointless to use compilation constants, as you can't "debug" a service very easily, and you can't pass...
4
by: gwhite1 | last post by:
I use this code to capture a screen in a regular VB 2005 windows app. It works great! I found the code in google. But when I create a windows service it does not capture the screen. It only...
1
by: hanson | last post by:
How can i create the function of ScreenCapture in the windows service?????
1
by: hemant | last post by:
I am trying to Caputre the screen in windows service with the GDI Api of Win32 in vb.net 1. CreateDc 2. CreateCompatibleDC 3. CreateCompatibleBitmapDc 4. Bitblt 5. SelectObject 6. ...
3
by: =?Utf-8?B?Zmh1bnRlcg==?= | last post by:
I have a Windows Service that should pop a windows form right before logoff, for the user to enter some information. I got things working fairly well except that the user does not get to see the...
4
by: pbd22 | last post by:
Hi I am making my way through a windows service that accepts custom telnet commands as strings and then parses the string and redirects it. This would be a custom string sent via telnet. ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.