Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Need help with automatically clicking  a button -->

Posted on 2000-05-17
1
Medium Priority
?
130 Views
Last Modified: 2010-05-02
I have developed a VB application already that automatically selects another window and sends a key-stroke using the ShowWindow API function and the SendKeys function - this works fine.

However I now need to select the other application and then click on a specific button within this window - the other application will be Internet Explorer running a Java application - I would welcome any comments on how to best perform this with VB5.

Thanks.
0
Comment
Question by:DrDread
1 Comment
 
LVL 7

Accepted Solution

by:
Vbmaster earned 300 total points
ID: 2817175
Try the mouse_event API, with the help of this API a mouse-click. Use it with the MOUSEEVENTF_LEFTDOWN message and then send a MOUSEEVENTF_LEFTUP message right after.

   Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)

   Public Const MOUSEEVENTF_LEFTDOWN = &H2
   Public Const MOUSEEVENTF_LEFTUP = &H4


You can position the mouse with the help of the SetCursorPos API, but you can try the dx and dy parameters of the mouse_event API first.

   Declare Function SetCursorPos Lib "user32" Alias "SetCursorPos" (ByVal x As Long, ByVal y As Long) As Long
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month21 days, 1 hour left to enroll

810 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