Solved

Need help with automatically clicking  a button -->

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
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…
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…

757 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

18 Experts available now in Live!

Get 1:1 Help Now