How to automate another application?

S

Siegfried Heintze

I have an application I want to automate. I don't believe it has COM
automation (how do I tell?)

Is there a .NET counterpart to COM automation? If so, how would I determine
if this application supports it?

The only way I can think to automate it is to enumerate all the windows on
the system in a combo box, have the user select one and then send
WM_LDOUBLECLICK and WM_KEYDOWN via pinvoking sendMessage or PostMessage
(which one?) to the application. Is there a better way to do this?

Thanks,
Siegfried
 
M

Martin Bonner

I have an application I want to automate. I don't believe it has COM
automation (how do I tell?)
Look for an associated type library. It will either be in a seperate
file called xxxx.tlb, or bound into the executable ... but see later.
Is there a .NET counterpart to COM automation? If so, how would I determine
if this application supports it?

Yes, there is (sort of). You can call a function in one process from
another process (search for "Remoting"). The easy way to find if the
application supports it, is to try and add a reference to the
applicaton .exe in your project. Conveniently, this will work for COM
automation as well.
The only way I can think to automate it is to enumerate all the windows on
the system in a combo box, have the user select one and then send
WM_LDOUBLECLICK and WM_KEYDOWN via pinvoking sendMessage or PostMessage
(which one?) to the application.
SendMessage won't return until the application has handled the
message, PostMessage will return immediately, and wait for the
application to handle it eventually.
Is there a better way to do this?
Possibly not, but this is fragile. If the user clicks somewhere you
aren't expecting you will get grief. If the next release of the
application re-orders controls on the user interface you will get
grief. If some of the inputs depend on WM_CHAR rather than WM_KEYDOWN
you will get grief.


Oh. The other approach is to ask the vendors of the application if
there is some way to automate it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top