And again, many thanks for your insight.
You are welcome.
Bed got the better of me about 5 minutes after i
replied yesterday, so apologies for the belated
response.
I'm writing a program that is a remote control for another application.
I would like to record information about 'how the other app is used',
(in particular how its mdi forms are moved around) but the jounal
record/playback doesnt fit the bill because when i am remote
controlling the other app, it sits under a transparent window in my
form.
Totally complicated, but absolutely necessary!
Besides, the other apps mid windows always popup in stupid places. lol,
standard.
There are also a million other functions i would like to include, and
most of them will need to peer into the messages of particular windows
in the accursed other app.
OK, so this is at the level of thinking out loud so take it with a grain of
salt.
You might want to take a look at the Computer Based Training (CBT) hook. The
problem it lives to solve is not remote control but rather user training.
Typically these applications first demonstrate a sequence of user interface
options and say - OK - now you try it. That's where the hook comes into
play. I receives notification of the user's actions and compares that to
what it expected to see if the user is catching on. Perhaps that's along the
lines of what you want when you say
<quote>
I would like to record information about 'how the other app is used'
</quote>
There is another option as well. I am assuming that you don't have the
source to the application that you want to control. So at first blush you
need the system wide hook bit it seems intrusive and wasteful where you want
to control one application. So you might want
[In your application]
a) register a private message - see RegisterWindowMessage()
b) set a WH_CALLWNDPROC hook system wide - SetWindowsHookEx(WH_CALLWNDPROC,
...)
c) send the target application the registered message
[in your hook DLL]
d) on reception of the private message load your remote control stuff into
the target application
(because you get control in the target process (on NT/2K/XP/2K+3) you can
now use thread specific hooks)
[in your application]
e) remove the hook after having sent the private message
In that way, you have a system wide hook installed only for the short time
it takes to put your remote control business in operation. Note that no
matter how you go, debugging code that you use to instrument an external
application is always a bear. Good luck.
Regards,
Will