Link to home
Start Free TrialLog in
Avatar of olmy
olmy

asked on

Controlling mouse,dialogs,text of another program

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?
ASKER CERTIFIED SOLUTION
Avatar of Pegasus100397
Pegasus100397

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of olmy
olmy

ASKER

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.
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
Avatar of olmy

ASKER

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.
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
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!