Intercepting Another Application's Events

  • Thread starter Thread starter Curious Coder
  • Start date Start date
C

Curious Coder

I have been tasked with a project that I do not think can be accomplished.

Our company has an application that runs as an unmanaged ActiveX control on
user desktops. It is designed to work with our phone system.

When a phone call comes in, users can click a button on the ActiveX control
and begin recording.

My task is to fire off this recording, behind the scenes, without user
interaction, using the existing instance of the ActiveX control. The control
has an extensive API that I can use IF I were creating a separate
application, but basically I have to create an application that sits in the
system tray (ok), and have it behave as an event sink for this external
control (not ok).

There is other functionality I have to perform without user action, but if I
can at least manage this, I can work out the rest.

Personally, I dont think its possible. If it is, the only thing I can think
of is somehow accessing its process space and intercept its threads, but to
do what?

Any direction is GREATLY appreciated. Thank you to the community.
 
I have been tasked with a project that I do not think can be accomplished.
Pretty much everything is possible. Just desire to make it happen.
Our company has an application that runs as an unmanaged ActiveX control on
user desktops. It is designed to work with our phone system.

When a phone call comes in, users can click a button on the ActiveX control
and begin recording.

My task is to fire off this recording, behind the scenes, without user
interaction, using the existing instance of the ActiveX control. The control
has an extensive API that I can use IF I were creating a separate
application, but basically I have to create an application that sits in the
system tray (ok), and have it behave as an event sink for this external
control (not ok).

Don't understand the "If I were creating a separate application"... and
then immediatly followed by "I have to create an application."

And then you say API... well... it sounds like you have all the ingredients
you need to make this thing work.

there is also the win32 API and you could intercept messages to / from the
application...

There is other functionality I have to perform without user action, but if I
can at least manage this, I can work out the rest.

Personally, I dont think its possible. If it is, the only thing I can think
of is somehow accessing its process space and intercept its threads, but to
do what?

Again... you have an API... so I don't quite understand what your problem
is...
 
CJ:

Thanks for the reply. Let me clarify the items you asked about.

" The control has an extensive API that I can use IF I were creating a
separate application.."
By this I mean if I were creating a separate winform that had the ActiveX
control dropped on it, I could use the ActiveX's API to access all the
events raised by it.

And here is where my question lies. Instead of doing the above, I need to do
what you describe later in your reply: Intercept messages and events as they
are raised in this external application and catch them in my system tray
application.

further research Ive done seems to point me to creating a "hook" DLL (this
is an example I found:
http://www.codeproject.com/dll/hooks.asp?target=intercept|application|events#xx748053xx)

but its written in C (which is OK I guess). Can I use VB.Net to intercept
the messages from the application? In this case, I would want to intercept
the event that is fired when a call comes in, so I could "force" the
application to record. Bear in mind that I dont want my system tray app to
record, I want it to cause the existing ActiveX control to fire its own
Record event... hope that clears it up.
 
This is a good hook example of using the Win API, as I mentioned in my first
post for intercepting messages. But you have to know what messages your
looking for.

Second, you may want to check to see if the events contained in your active
x control are shared or not, becuase you can still drop an active x control
into a service, and if it has shared events (static whatever) then you're
job will be easy.

I think the hook example is a little extreme. And C is your only choice
because of the way it injects itself into the process. Managed doesn't have
this ability.
 
Back
Top