Trapping Another Windows Events

  • Thread starter Thread starter Mr Sparkles
  • Start date Start date
M

Mr Sparkles

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
 
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 said:
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...
 
Back
Top