how to record keystrokes and mouse clicks

  • Thread starter Thread starter Jeff
  • Start date Start date
J

Jeff

A friend of mine doesn't have a computer at home, and uses one at the Senior
Center every day. Since they're public computers, all the settings are
reset to defaults when they're rebooted, which happens automatically
overnight even if nobody does it manually. He was talking about having to
change settings to the way he likes them every day -- unlock the taskbar,
show Quick Launch, set the font face and size in WordPad, set the margins on
Page Setup, allow active content to run from local files in IE,... It amused
me to write a little app that changed all these settings to the way he liked
them, using CreateProcess to start up apps, and SendMessage to send
keystrokes and mouse clicks to them. I gave it to him so he could put it on
his flash drive and run it when he got to the Senior Center every morning.
When he watched it running, popping up app windows and changing their
settings, he asked me, "So you have something that records keystrokes, and
now you're just playing them back?"

His question sort of intrigued me. I heard of something like this a few
years ago, somebody I talked to at Yahoo chess was running long joke
messages through the chat area. He said he had something that would record
his keystrokes and save them as "macros", and play them back. Apparently
there's shareware out there that does this kind of thing, but as you might
guess from what I've already said, I write computer programs for fun, and
with shareware, somebody else gets to have all the fun. Besides that, I
never put shareware on my computer anyway, because of the possibility that
it contains viruses or worms or whatever.

I've fiddled around some, trying to figure out how to record keystrokes and
mouse clicks. First I tried to use SetCapture, but as soon as the mouse
clicks on something outside the app window that has the capture, it loses
the capture. Then I tried setting up a transparent window over the whole
screen and passing on all mouse clicks and keystrokes to the window that
would receive it if my transparent window weren't there, but that didn't
work either, because windows react differently to input if they're covered
up by another window, even if it's transparent.

So I'm thinking, I must be going at this from the wrong direction. MSDN
mentions a system message queue, and says that input messages are
distributed from that queue to the individual message queues of threads with
a GUI. It seems like, maybe I need some kind of hook that will let me
record the messages at that time, but I haven't been able to find anything
at all about the system message queue beyond that mention.

So anyway, does anybody know how I can record mouse clicks and keystrokes so
that I can play them back for things that I do frequently, rather than
having to key it all in again myself every time -- or tediously write
hard-coded apps for each task?

Thanks,
Jeff
 
Jeff said:
A friend of mine doesn't have a computer at home, and uses one at the
Senior Center every day. Since they're public computers, all the
settings are reset to defaults when they're rebooted, which happens
automatically overnight even if nobody does it manually. He was talking
about having to change settings to the way he likes them every day --
unlock the taskbar, show Quick Launch, set the font face and size in
WordPad, set the margins on Page Setup, allow active content to run from
local files in IE,... It amused me to write a little app that changed
all these settings to the way he liked them, using CreateProcess to
start up apps, and SendMessage to send keystrokes and mouse clicks to
them. I gave it to him so he could put it on his flash drive and run it
when he got to the Senior Center every morning. When he watched it
running, popping up app windows and changing their settings, he asked
me, "So you have something that records keystrokes, and now you're just
playing them back?"

His question sort of intrigued me. I heard of something like this a few
years ago, somebody I talked to at Yahoo chess was running long joke
messages through the chat area. He said he had something that would
record his keystrokes and save them as "macros", and play them back.
Apparently there's shareware out there that does this kind of thing, but
as you might guess from what I've already said, I write computer
programs for fun, and with shareware, somebody else gets to have all the
fun. Besides that, I never put shareware on my computer anyway, because
of the possibility that it contains viruses or worms or whatever.

I've fiddled around some, trying to figure out how to record keystrokes
and mouse clicks. First I tried to use SetCapture, but as soon as the
mouse clicks on something outside the app window that has the capture,
it loses the capture. Then I tried setting up a transparent window over
the whole screen and passing on all mouse clicks and keystrokes to the
window that would receive it if my transparent window weren't there, but
that didn't work either, because windows react differently to input if
they're covered up by another window, even if it's transparent.

So I'm thinking, I must be going at this from the wrong direction. MSDN
mentions a system message queue, and says that input messages are
distributed from that queue to the individual message queues of threads
with a GUI. It seems like, maybe I need some kind of hook that will let
me record the messages at that time, but I haven't been able to find
anything at all about the system message queue beyond that mention.

So anyway, does anybody know how I can record mouse clicks and
keystrokes so that I can play them back for things that I do frequently,
rather than having to key it all in again myself every time -- or
tediously write hard-coded apps for each task?

Thanks,
Jeff


Jeff, as well as Richard's suggestion you might find this site
interesting...

http://www.codeproject.com/
 
Jeff said:
A friend of mine doesn't have a computer at home, and uses one at the
Senior Center every day. Since they're public computers, all the settings
are reset to defaults when they're rebooted, which happens automatically
overnight even if nobody does it manually. He was talking about having to
change settings to the way he likes them every day -- unlock the taskbar,
show Quick Launch, set the font face and size in WordPad, set the margins
on Page Setup, allow active content to run from local files in IE,... It
amused me to write a little app that changed all these settings to the way
he liked them, using CreateProcess to start up apps, and SendMessage to
send keystrokes and mouse clicks to them. I gave it to him so he could put
it on his flash drive and run it when he got to the Senior Center every
morning. When he watched it running, popping up app windows and changing
their settings, he asked me, "So you have something that records
keystrokes, and now you're just playing them back?"

His question sort of intrigued me. I heard of something like this a few
years ago, somebody I talked to at Yahoo chess was running long joke
messages through the chat area. He said he had something that would
record his keystrokes and save them as "macros", and play them back.
Apparently there's shareware out there that does this kind of thing, but
as you might guess from what I've already said, I write computer programs
for fun, and with shareware, somebody else gets to have all the fun.
Besides that, I never put shareware on my computer anyway, because of the
possibility that it contains viruses or worms or whatever.

I've fiddled around some, trying to figure out how to record keystrokes
and mouse clicks. First I tried to use SetCapture, but as soon as the
mouse clicks on something outside the app window that has the capture, it
loses the capture. Then I tried setting up a transparent window over the
whole screen and passing on all mouse clicks and keystrokes to the window
that would receive it if my transparent window weren't there, but that
didn't work either, because windows react differently to input if they're
covered up by another window, even if it's transparent.

So I'm thinking, I must be going at this from the wrong direction. MSDN
mentions a system message queue, and says that input messages are
distributed from that queue to the individual message queues of threads
with a GUI. It seems like, maybe I need some kind of hook that will let
me record the messages at that time, but I haven't been able to find
anything at all about the system message queue beyond that mention.

So anyway, does anybody know how I can record mouse clicks and keystrokes
so that I can play them back for things that I do frequently, rather than
having to key it all in again myself every time -- or tediously write
hard-coded apps for each task?

Thanks,
Jeff

Here's an interesting hardware gadget. It only records
keystrokes though.

http://www.thumbsupuk.com/products/USB-KeyShark.htm?id=''&prodid=373&cc=
 
Back
Top