473,782 Members | 2,465 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 13094
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
"cashdeskma c" 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
"cashdeskma c" 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.co m

"cashdeskma c" <ca*********@di scussions.micro soft.comwrote in message
news:20******** *************** ***********@mic rosoft.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
415
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 this class in a windows service, the snapshot comes up as a black screen. Any idea why? or how do I get around it? The class works fine if I use it in a regular windows forms application.
9
7273
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 stopping. Please advise how to stop the service. Thanks, SP
0
1307
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 the window (dialog) it always comes back with zero. Now - in my test application (not service) it runs fine....
5
1575
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 in a command line arguement (can you?) to tell it to do something special like capture errors to a file while it's running. Has anyone figured out any good ways to do this type of run-time error capturing? Basically, if I were building a...
4
5374
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 captures a blank graphic. Does anyone know why it will not capture the current screen? Is something not available when running as a service? Thanks!!! Sheila Function CreateScreenshot() As System.Drawing.Bitmap Dim Rect As System.Drawing.Rectangle =...
1
1776
by: hanson | last post by:
How can i create the function of ScreenCapture in the windows service?????
1
2319
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. DeleteDc The Caputured screen file is always black
3
2277
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 form before logoff. But I know that it run properly because when I log back in the form is there and works fine. So the form opened and run, but windows was already in the "logoff" screen with no desktop showing, so I missed the form. Is there any...
4
2870
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. So, I need to prompt the user for input and then capture that imput, parse it into a form that is readable (strings in
0
9641
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10146
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10080
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9944
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8968
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7494
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5378
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2875
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.