Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / March 2008

Tip: Looking for answers? Try searching our database.

How to automate another application?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Siegfried Heintze - 13 Mar 2008 01:18 GMT
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
Martin Bonner - 13 Mar 2008 11:45 GMT
On Mar 13, 12:18 am, Siegfried Heintze
<SiegfriedHein...@discussions.microsoft.com> wrote:
> 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.

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.