Solved

Controlling mouse,dialogs,text of another program

Posted on 1997-10-16
6
132 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
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

809 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