Solved

Controlling mouse,dialogs,text of another program

Posted on 1997-10-16
6
129 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
  • 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now