Solved

Need help with automatically clicking  a button -->

Posted on 2000-05-17
1
125 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 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…

820 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