Solved

Need help with automatically clicking  a button -->

Posted on 2000-05-17
1
127 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
[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
1 Comment
 
LVL 7

Accepted Solution

by:
Vbmaster earned 100 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

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…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

690 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