Solved

Controlling mouse,dialogs,text of another program

Posted on 1997-10-16
6
133 Views
Last Modified: 2010-04-04
By planning to build a StepbyStep help program.
It's a tutorial program for beginners. StepbyStep moves mouse, presses buttons and types text into dialogs of another program.

How can it be done?
0
Comment
Question by:olmy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 3

Accepted Solution

by:
Pegasus100397 earned 100 total points
ID: 1347729
Olmy,

For 50 points I'll give you a general overview of the steps :)

First, use API calls to get a list of running tasks until you locate the application you want to control.

Once you've done that, run through the child windows of the "screen" (form) to determine what buttons, etc are on it (the ones you wish to control)

With knowledge of the controls on the foreign form your program can issue standard windows messages to themt such as WM_Click, etc.

Hope this helps :)
Pegasus
0
 
LVL 1

Author Comment

by:olmy
ID: 1347730
OK, points added to 100 - sorry for the lower 50. I haven't used this that much so it's quite hard to estimate correct points.

You gave me instructions how to handle dialogs and tasks, but how to move mouse cursor? And perhaps little more instructions to first steps.
0
 
LVL 3

Expert Comment

by:Pegasus100397
ID: 1347731
Olmy,
I had to do something similiar not too long ago (controlling the Dial Up Networking dialog with my program). There are about 7 good Windows API functions you'll need to use and some are rather lengthy. As opposed to posting them here (which would violate the copyright of the book where *I* got them!) I'll point you where to look for *everything* your trying to do here:

Look in Chapter 14, "Windows API Functions" page 481+ in the  book called DELPHI PROGRAMMING PROBLEM SOLVER by Neil Rubenking, ISBN# 1-56884-795-5

I know it's not the best way to answer but I don't know how to give you an answer here without violating the copyright of the book's examples. I wish you luck with your tutorial.... NEXT! :)

Pegasus
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:olmy
ID: 1347732
All right. I'm not planning to buy a book for this purpose - sorry.

I will accept your answer if you name the api calls. I think I can find out how they should be used. I'm still intrested how to move the mouse cursor.

I'm sorry if I'm wasteing your time.
0
 
LVL 3

Expert Comment

by:Pegasus100397
ID: 1347733
Olmy,
Wasting my time? Never! I like the challenge of the questions posted here, the "points" thing is just for fun! :)

Check out the SetCapture API function to capture mouse movements outside of your application

The Mouse_Event API function is a blast for moving the mouse around and simulating button clicks! I used this in a "gag" application as a joke against another programmer, made his mouse move opposite of his physical hand motion. It was a riot! :)

The FindWindow function is but one of many that will help you locate the window handle of the application that you want to "control".  Once you bring up the Win32s help on this function, click on the GROUP hyperlink to get access to tons of other API functions to get info about the application you are running the tutorial on. Of main interest is, of course, the FindWindow to get the handle to the app your tutoring on and EnumChildWindows to find all of the controls currently visible on the app (that you found with FindWindow).

Even if you don't accept the answer, please continue to comment on your progress and I'll be glad to help where I can :)

Pegasus
0
 
LVL 12

Expert Comment

by:andrewjb
ID: 1347734
Mouse capture won't work in 32-bit windows ( NT or 95 ) for the stuff you want to do.

Look at the SetWindowsHookEx API calls. You'll need a DLL. It isn't dead easy, but not too bad.

You'd do a hell of a lot better if you looked at a book, though!

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

761 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question