469,569 Members | 1,507 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,569 developers. It's quick & easy.

Trapping Another Windows Events

Heya Everyone,

I am currently creating an application audit system that will log how
much use an application will be used by employees of my company, and
the type of features they use...so I wanted to have a .NET program or
service running in the background that would log what actions they
perform in specified applications and update our main database...but I
am running into problems trapping the events of when people click on
buttons etc.,

I can currently trap where the mouse is on the screen and do a dodgy
report, but it is limited by many other extenuating factors so...

What I am looking for a way to trap another Window's message events.
I.e., I want to create a program that will log when someone clicks on
a specified application's button, or find out when someone changes the
selection from a listbox...

I don't know if this is at all possible. I have tried subclassing
examples, but they never work or lock up my machine and only seem to
want to subclass on an application form, but I wqant to go down to the
level of the controls

Does anyone know of any C#, VB.NET or even VB6 source code that can do
this or could possibly point me in the right direction..
Thanks in advance and keep up the good work :D
Nov 15 '05 #1
2 4754
Hi,

Seems that global Windows message hook is what you need. This can be
achieved in C# but it seems to me that unmanaged languages are better for
this purposes as you'll most likely be doing much raw API calls. You may try
to search the Net for so-called "keyloggers" and for setting up global hooks
(Google Groups search would be suitable here too).

It is also quite possible you'll find most of the examples written in C/C++
but VB6 ones should also exist.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Unit Testing and Integration Environment
http://x-unity.miik.com.ua
Deliver reliable .NET software

"Mr Sparkles" <pr***********@hotmail.com> wrote in message
news:e9**************************@posting.google.c om...
Heya Everyone,

I am currently creating an application audit system that will log how
much use an application will be used by employees of my company, and
the type of features they use...so I wanted to have a .NET program or
service running in the background that would log what actions they
perform in specified applications and update our main database...but I
am running into problems trapping the events of when people click on
buttons etc.,

I can currently trap where the mouse is on the screen and do a dodgy
report, but it is limited by many other extenuating factors so...

What I am looking for a way to trap another Window's message events.
I.e., I want to create a program that will log when someone clicks on
a specified application's button, or find out when someone changes the
selection from a listbox...

I don't know if this is at all possible. I have tried subclassing
examples, but they never work or lock up my machine and only seem to
want to subclass on an application form, but I wqant to go down to the
level of the controls

Does anyone know of any C#, VB.NET or even VB6 source code that can do
this or could possibly point me in the right direction..
Thanks in advance and keep up the good work :D


Nov 15 '05 #2
"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.com> wrote in message news:<eQ**************@TK2MSFTNGP12.phx.gbl>...
Hi,

Seems that global Windows message hook is what you need. This can be
achieved in C# but it seems to me that unmanaged languages are better for
this purposes as you'll most likely be doing much raw API calls. You may try
to search the Net for so-called "keyloggers" and for setting up global hooks
(Google Groups search would be suitable here too).

It is also quite possible you'll find most of the examples written in C/C++
but VB6 ones should also exist.

--


Hi Dmitriy,

Thanks for the speedy reply :D

Yeah I have been playing around with such things, however, I have not
had much luck getting this kind of thing to work. Windows seems to
have issues with releasing the sub-class from a control...and I can;t
even get the damn thing to peek at the messages correctly. I don't
actually want to trap the keyboard input...I don't believe in spying
on my workmates and that would be a massive security breach which I am
not going to facilitate, but rather I would trap when the click on a
button in a particulart program that I select...For example, if my
boss wants me to do a software audit for the next year's budget, and
we are cutting back (Like everyone is nowadays) and most of our staff
use MS Word, but we find out they are not using the extra
functionlaity and just typing things out and using spell checkers,
then we could get alternatives with lower costs and better
training...so the only way I could do that is by finding a way to trap
the notifications that go in and out of the controls to find out how
the staff are using the software...

I can find out what software they are using by peeking into the window
name...and I can find out the locations of the controls in regards to
the screen, but I just can't read when a user clicks on a button, or
selects a particular option from a drop-down box etc., these are the
core things I need to know for this thing to work and work well...

so again, if anyone has any ideas how to do this, then please let me
know...
Nov 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Peter Frost | last post: by
2 posts views Thread by Kevin | last post: by
5 posts views Thread by Jeff Ptak | last post: by
1 post views Thread by Chirag Malvi | last post: by
reply views Thread by Hanover | last post: by
1 post views Thread by Elmo Watson | last post: by
19 posts views Thread by zacks | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.