Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Clicking A Button On An External Application


Hello, I'm trying to click a button on another application, but I can't get it to work. The button is a few layers down, but it never finds the button. What am I doing wrong?

I've included a screenshot of Spy++ to show the structure.



VB Code:
Option Explicit 'API Declarations to Find Parent and Child windowsPrivate Declare Function FindWindow Lib "user32" Alias "FindWindowA" _(ByVal lpClassName As String, ByVal lpWindowName As String) As LongPrivate Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _(ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long 'API Declarations to send messages to Parent and Child windowsPrivate Declare Function SendMessage Lib "user32" Alias "SendMessageA" _(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long 'Constants DeclarationsPrivate Const BM_CLICK As Long = &HF5    'To click a button   Private Sub Command1_Click()    Dim hParent As Long    Dim hChild As Long        hParent = FindWindow("#32770", "eMule Plus v1.2")        If hParent <> 0 Then                hChild = FindWindowEx(hParent, 0&, "#32770", vbNullString)        hChild = FindWindowEx(hChild, 0&, "Button", "Reload")                If hChild <> 0 Then            Call SendMessage(hChild, BM_CLICK, 0, 0)        End If    End IfEnd Sub




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Clicking A Button On Toolbar Of External App
Hello, does anybody know how to click/press the first button on the toolbar of an external application? The code below finds the button and presses it, but the event behind the button is not triggered. How can I trigger the event of that button?


Button is pressed, but event not triggered.
http://img510.imageshack.us/img510/1408/screenlz1.png



Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, _
ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, _
ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long

'Private Const BM_CLICK As Long = &HF5

Private Const WM_USER = &H400
Private Const TB_PRESSBUTTON = (WM_USER + 3)

Private Sub Command1_Click()
Dim hParent As Long
Dim hChild As Long

hParent = FindWindow("TfrmMain", vbNullString)
Debug.Print hParent

If hParent <> 0 Then

hChild = FindWindowEx(hParent, 0&, "TPanel", vbNullString)
hParent = FindWindowEx(hParent, hChild, "TPanel", vbNullString)
hChild = FindWindowEx(hParent, 0&, "TPanel", vbNullString)
hParent = FindWindowEx(hParent, hChild, "TPanel", vbNullString)
hChild = FindWindowEx(hParent, 0&, "TToolbar", vbNullString)
Debug.Print hChild

If hChild <> 0 Then
Call SendMessage(hChild, TB_PRESSBUTTON, 0, 0)
End If
End If
End Sub

Clicking First Button On Toolbar Of External App
Hello, does anybody know how to click/press the first button on the toolbar of an external application? The code below finds the button and presses it, but the event behind the button is not triggered. How can I trigger the event of that button?


Button is pressed, but event not triggered.




vb Code:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As LongPrivate Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As LongPrivate Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long'Private Const BM_CLICK As Long = &HF5 Private Const WM_USER = &H400Private Const TB_PRESSBUTTON = (WM_USER + 3) Private Sub Command1_Click()    Dim hParent As Long    Dim hChild As Long        hParent = FindWindow("TfrmMain", vbNullString)    Debug.Print hParent        If hParent <> 0 Then                hChild = FindWindowEx(hParent, 0&, "TPanel", vbNullString)        hParent = FindWindowEx(hParent, hChild, "TPanel", vbNullString)        hChild = FindWindowEx(hParent, 0&, "TPanel", vbNullString)        hParent = FindWindowEx(hParent, hChild, "TPanel", vbNullString)        hChild = FindWindowEx(hParent, 0&, "TToolbar", vbNullString)        Debug.Print hChild                If hChild <> 0 Then            Call SendMessage(hChild, TB_PRESSBUTTON, 0, 0)        End If    End IfEnd Sub

Running External Programs By Clicking A Button
Hello,
Would anyone be able to help me?
I wish to make it so when a button is clicked on, it will close my program and start running a program (eg word.exe).
Thanks!

Finding Another Application And Clicking A Button
Hi guys i need some help with this

I wanted to click another app's button through vb6
let's say another messagebox from another application
and i needed to press the 'ok' or 'cancel' button whatever
can someone help me with this?

thanks in advance

Minimise Or Maximise Any Application Window By Clicking On Button
actually i want to minimise or maximise any application window by clicking on button

Open A Website On Clicking A Command Button In VB 6.0 Windows Application
Hi I have developed a windows application using VB 6.0.
When the application is run for the first time a License activation Form pops up with a Command button Activate.
All i want is to open a web site for registration when clicking the Activate button.Can some one tell me how to achieve this.Thanks

How Do You Push A Button On An External Application?
I need my visual basic application to push a button on an application using the mouse.

I know I do this (somehow) with API calls etc.

Could somebody give me a rough idea where to begin with this?

How To Load External .exe Application And Click A Button
HI all i got an .exe applicaton which is mssanger and i want to load it on click of button and click on one of its button that logins me in all on click of one button. But i do not know how to do this. i be happy if some show me how i can do this.Thanks

Button Click On External Application (RESOLVED)
I was wondering if it is possible to create a VB program that can handle a button click on an external application. If so, how would I go about doing this?

Thanks!



Edited by - jseal on 4/21/2006 4:09:52 AM

How To Close The Application When Clicking On The Close Button In Title Bar
guys,

how to close the application when the user click on the close button on the title bar?


pls suggest

CODE For BROWSE BUTTON By CLICKING The BUTTON
i dont know what is the code for browsing files by clicking a button.... can u pls help me???

Creating A Cammand Button From Clicking A Button
Hi, What is the code to create a button? I want to click a button and create a new one on click.

Clicking A Button Twice.
Hello to all and thanks for reading this post.
This is simple i know, but for some reason still boggles my mind.

How would i tell a button (a picture actually) that when clicked on the first time to show another button (picture) but when click on again, it will hide the added button (picture)


Thanks for any replies!

Button Clicking
Does anyone know how to make a button do something different after being clicked a second time?

Here's my case: I need a button, once clicked, to make .visible=true after clicked once. After being clicked again I need it to make .visible=false.

Maybe I'm going about this the wrong way, but basically clicking button needs to make something appear, clicking it again needs to make it disappear.

Anyone got a clue what I'm talking about?

How Do You Run An .exe By Clicking A Button?
I was wondering if it was possible to run an .exe through a command line in VB. I want it so that when I click a button, it'll run a program. (Ex.: CommandButton1 would run C:Program FilesiTunesiTunes.exe)
How would I do this?

Thanks for the help.

P.S. Sorry if this has been answered before, but I couldn't find anything like this when I searched.

Clicking On The 'x' Button
is it possible to run some code in the event of the user clicking on the 'x' button (top right)?

Button Clicking
How can I sense how many times a button was clicked (eg. say a button was clicked twice and on the first time it did one thing but on the second time it did something else then on the third time it went back to what it did on the first click, and it keeps looping itself) THANKS!!!!!!!!!

Clicking A Button Using API..HELP!
Hi, I'm making a program that clicks on a button. This program pops up a box that you have to click "ok" on inorder to stay active. Now, its not a standard Msgbox, its a small form that opens and there is a big button that says "OK". Here is the info:


The Main Programs window class info:

ClassName: "TApplication"
Text: "09"

---------------------------------
The Form that opens up:

ClassName: "TConMsgBox"
Text="10"

----------------------------------

The button:

ClassName: "TButton"
Text: "OK"
------------------------------------
Ok, I'm new to API but here is what I have but it doesn't work.


VB Code:
Do: DoEvents Window% = FindWindow("TForm1", vbNullString) Window2% = FindWindow("TConMSgBox", Window%)   If Window% ThenButton% = FindWindowEx(Window%, Window2%, "TButton", "OK")Click Button% Exit DoEnd IfLoop

any help appreciated! thanks!

Button Clicking
I have a website... say for example this one. I want to make a program to save my passwords and user names and when I go to the site I just press a button and it enters it for me, then clicks the login button. Any idea how to fill in text fields and press buttons on a website through VB code? Any help is GREATLY appreciated. Later,

zer0_flaw

Clicking A Button
hi,

their is a button on a webpage that i have to click before i can move onto the next part..
how can i make vb "click" that button, so my program can move onto the next part?
any help would be great!
thanks

Clicking Button
I am launching a program from my VB app. I then want my app to go ahead and click a button in this app that says Update. Is there some way to do this?

It seems to me that I saw that I will need to use Spy++ to find some information. I am really new to this area and so any help is appreciated. Thanks!

Clicking On A Button...
Hello!
I need to raise a click-event on a command button which is on another application.
How can I manage to do that...
I tried using the windows API PostMessage Function to broadcast the WM_LBUTTONDOWN message to this particular program, but, it seemed not to work...
So, any idea is welcome!
Thank you!

Button Clicking
I have a form with a text field and a button. I don't want the text field to be visible all the time, so what I want to do is when the user clicks the button have the text field become visible and have the button continue to look like it is depressed as long as the text field is visible and then when the user clicks the button again, the text field disappears and the button goes back to normal. Any idea how to do that?

------------------
Ryan

How To Get New Forms By Clicking On A Cmd Button?
Hi, I'm only brand new to VB but I've got to design a GUI for a project that I'm doing (it is to display the results from six different weather instruments). I'm not sure the best way to do this but I thought that it would be a good idea if I could have a main form where the user could click on one of six command boxes (eg, rainfall, wind direction etc) and then another form could pop up for the appropriate choice. However I have no idea how to do this so please any help or advice would be GREATLY appreciated.

Clicking On Submit Button
how do I click on a submit button taht doesnt have a name n the form doesnt have a name?

Clicking On A Submit Button
I have this website that I want to click on a submit button. I already know how to add a value into a text so now I want to submit it. But the submit button doesn't seem to have a name. And the form just has "action=..." and "method=...". BTW, there are 2 submit buttons on the page.

Clicking Toolbar Button On Another App
Hi, does anybody know how to click the first Toolbar button on another app?
I tried TB_PRESSBUTTON and it sets the first button to tbrPressed, but it doesn't run the Toolbar click event.


Code:
Option Explicit

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
'Private Const BM_CLICK As Long = &HF5

Private Const WM_USER = &H400
Private Const TB_PRESSBUTTON = (WM_USER + 3)

Private Sub Command1_Click()
Dim hParent As Long
Dim hChild As Long

hParent = FindWindow("TfrmMain", vbNullString)
'Debug.Print hParent

If hParent <> 0 Then

hChild = FindWindowEx(hParent, 0&, "TPanel", vbNullString)
hParent = FindWindowEx(hParent, hChild, "TPanel", vbNullString)
hChild = FindWindowEx(hParent, 0&, "TPanel", vbNullString)
hParent = FindWindowEx(hParent, hChild, "TPanel", vbNullString)
hChild = FindWindowEx(hParent, 0&, "TToolbar", vbNullString)
'Debug.Print hChild

If hChild <> 0 Then
Call SendMessage(hChild, TB_PRESSBUTTON, 0, 0)
End If
End If
End Sub

Clicking Command Button Twice...
Hi, I am looking for a way to see if a user has clicked a command button twice, and then if so I would like to disable the command button..

Private Sub btn_equipment_Click(Index As Integer)
Dim tmpFlash, tmpSmoke As String
tmpFlash = 0 'Flash click counter starts at zero.
tmpSmoke = 0 'Smoke click counter starts at zero.

If btn_equipment(2) Then 'If btn_equipment(2) is clicked then.
tmpFlash = tmpFlash + 1 'Add 1 to tmpFlash
If tmpFlash >= 2 Then 'Check to see if command button has been clicked twice.
btn_equipment(2).Enabled = False 'Disable command button.
Else
btn_equipment(2).Enabled = True 'Enable command button
End If
Debug.Print
End If

Debug.Print btn_equipment(Index).Tag
End Sub

Webbrowser (Clicking A Button)
I have a page loaded in the Webbrowser .

Need to click a particular button on the page from my vb program
I have had a look at the source. (the button is called Name ="Refresh1" ID="Refresh1" )... etc

Q1. Is there a simple send command to simulate clicking on this button.
----------------------------------

Q2. Is there a routine to list the controls visible on a webbrowser.
----------------------------------

Appreciate any help.

Clicking On A Button In Webbrowser??
I have a big problem I want to login to website, but I cannot press the button to submit the username and password.

Could you take a look at this page.
http://www.orangeworld.ch/login?&vie...on_begin_login
or
http://www.orangeworld.ch

Can you look at the Source code and figure out how to press the button in Webbrowser.

I would be very thankful for this!

tomaa

CLicking A Button In A Frame?
I know some other people also asked for this, and i tried to search the forum, but didn't got any answers that i found working.

So here we go again

Lets say i have this page with 2 frames. A login, and the real page. Now i wanna fill the username called UserName and the password called Password. Normally i would just do something like:

forms(0).Username.Value = "Myusername"

But I can't get that working.

Clicking A Button On A Web Page
I have been trying to get vb to automate a click of a button on a web page in webbroswer. The button on the page is <input type="submit" class="bginput" value="Agree">. WebBrowser1.Document.Forms(0).submit.Click works but, after it clicks it, it says error:object required. How can i get it to work?

Clicking Button On Web Page Through VB
I need to modify my VB code to click a button on a web page. The code I currently have is:

Dim oTrack

Set oTrack = docHTML.All("track")
oTrack.Click

This has worked fine but now the web developer for the webpage has made a change to block programs like mine because of 3rd party auditors. I am just trying to check on my own packages. They blocked it by naming a blank gif image "track" as well as the button that I am trying to click. Any ideas? I am new to VB, I would consider myself an amatuer but can modify code here and there. Any help would be greatly appreciated.

Bm_click Vs Clicking A Button...
I'm using:
btnpush = SendButtonMessage(newqt, BM_CLICK, 0, 0)

to open a window on another app, and trying to use:

progr = FindWindow(vbNullString, "New Quote")
If progr <> 0 Then
MsgBox "Good"
Exit Sub
Else
' Msgbox "No Good"
End If
Exit Sub

to try and determine when the page is opened. The problem I'm running into is that when using the sendbuttonmessage function, The findwindow isn't working, If I click on the button manually, I can find it, but using sendmsg, I'm returning nothing, anyone have an idea as to why?? Thanks for any help.

Clicking A Button On The Webbrowser.
OK guys , I know how to click a normal button with the Name property, but I have a listbox and a button next to it. I can select an item from the listbox - no problem, but I want to be able to click the button as well.
The code for the button is this:


Code:
<input class="btnlite" type="submit" value="Go" />


Could anyone help me?

Could Somebody Help Me Testing Please(by Clicking A Button)
I have just finished my program.
It connects to a USB interface board.
When the button(at www.purpledog.nl/led.php) is clicked,
my LED at home, is turned on/off(depending on it's recent status).
It worked when I tried it myself, but the app in running on my system, so I'm not sure if it also works with other people.

Thanx

Clicking A Form Button
ok I have made some code that fills out a series of forms for me and it works good exept on one of the pages there are two buttons and they are not submit buttons they are normal buttons... for example a submit button sends the form data to the link indicated by action= where as this button calls a function inside the webpage which does a few small things then submits.

so rather than WebBrowser1.Document.frmWebPermSettings.submit
I wont to click that button and here is some code to help u
Code:
<INPUT ID=onetidOk class="ms-ButtonHeightWidth" Type="button" Value=" OK " onclick="ConfirmAndSubmit()">
thats the code for the button I wont to press
Code:
function ConfirmAndSubmit()
{
var L_WebpermConfirm_Text = "Changing to inherited permissions may prevent you or other users from being able to access this Web site. Are you sure you want to continue?";
if( varWasUnique == 0 ||
!(document.getElementById("RadioPermInherited").checked) ||
confirm(L_WebpermConfirm_Text) )
{
document.forms.frmWebPermSettings.submit();
}
}

Thats the code the button calls

there are two buttons in the form "frmWebPermSettings" There is the one I wont to press "onetidOk" and the one I dont want to press "onetidClose"

please help if you need more code ask for it and I will post it .

Clicking The Max, Min N Close Button??
hi all!!!
how can i check if the user has clicked the 3 buttons on the top-right of the form?? any APIs to suggest??
thnx

Mousedown Button (without Clicking)
I have code that has been working using api to perform a clickbutton (sendmessage) (without actually using mouse to click), but now I switched the code to mousedown (because the button needs to repeat, and I have a timer enabled to repeat the command when mouse down, stop on mouseup). If I add a clickbutton event also, it messes with the mousedown and can send too many (an extra command) commands when the mouse button is released. Soo, how can I simulate a mousedown (and mouseup), so that I don't have to click. This is for a joystick to "click" a button. An alternative idea would be, how do I add a clickbutton event, but dont have it fire when the button is clicked, lol, just have it fire when SendMessage API says to Thanks!

Clicking An Applets Button In VB
Is it possible to click a Java Applet's button within an Internet Explorer control inside of Visual Basic? I know what the button name is, but I want the ability to click the button from VB.

Opening A .exe By Clicking A Button
how do you make my app open a executable by clicking a command button. PLease help mee!

Clicking A Button In A Web Page???
How can you automatically click a button on a web page!!!

Need To Run Query By Clicking On Cmd Button
I need to run a query that will sort through my access database and pull the data when a checkbox is selected from an access table. Please help.

Clicking Button In Javascript
How do i click the button in the following code?

        <TR valign="top">
          <TD align=right><span style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: #000066; FONT-FAMILY: Arial; TEXT-DECORATION: none">PIN:</Span> </TD>
          <TD><INPUT tabIndex=1 size=10 name=fblogincd></TD>
          <TD>&nbsp;&nbsp;&nbsp;</TD>
         <TD>&nbsp;&nbsp;&nbsp;</TD>
         <TD>&nbsp;&nbsp;&nbsp;</TD>
         <TD>&nbsp;&nbsp;&nbsp;</TD>
         <TD>&nbsp;&nbsp;&nbsp;</TD>

        </TR>
        <TR valign="top">
          <TD align=right><span style="FONT-WEIGHT: bold; FONT-SIZE: 10pt; COLOR: #000066; FONT-FAMILY: Arial; TEXT-DECORATION: none">Password:</Span></TD>
          <TD colspan=2><INPUT tabIndex=2 type=password size=10 name=fbpassword>&nbsp;&nbsp;<INPUT tabIndex=3 type=image alt=Login src="/01/images/Go.gif"></TD>
         <TD>&nbsp;&nbsp;&nbsp;</TD>
         <TD>&nbsp;&nbsp;&nbsp;</TD>
         <TD>&nbsp;&nbsp;&nbsp;</TD>
         <TD>&nbsp;&nbsp;&nbsp;</TD>
        </TR>
        <TR>
          <TD>&nbsp;</TD>
         <TD><a href="/itt/jsp/ITTPages/password.jsp" class="CliksHmPgMdlLnk">
         <span style="FONT-SIZE: 8pt; COLOR: #000066; FONT-FAMILY: Arial; TEXT-DECORATION: none"><U>Forgot your password?</U></span></a><br>
         </TD>
         <TD>&nbsp;&nbsp;&nbsp;</TD>
         <TD>&nbsp;&nbsp;&nbsp;</TD>
         <TD>&nbsp;&nbsp;&nbsp;</TD>
         <TD>&nbsp;&nbsp;&nbsp;</TD>
         <TD>&nbsp;&nbsp;&nbsp;</TD>
        </TR>


<INPUT tabIndex=3 type=image alt=Login src="/01/images/Go.gif"> <-- This is the image for the button

Clicking Toolbar Button On Another App
Hi, does anybody know how to click the first Toolbar button on another app?
I've already asked this on several places, but nobody seems to know how to do it. I tried TB_PRESSBUTTON and it sets the first button to tbrPressed, but it doesn't run the Toolbar click event.


Code:
Option Explicit

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
(ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
'Private Const BM_CLICK As Long = &HF5

Private Const WM_USER = &H400
Private Const TB_PRESSBUTTON = (WM_USER + 3)

Private Sub Command1_Click()
Dim hParent As Long
Dim hChild As Long

hParent = FindWindow("TfrmMain", vbNullString)

If hParent <> 0 Then

hChild = FindWindowEx(hParent, 0&, "TPanel", vbNullString)
hParent = FindWindowEx(hParent, hChild, "TPanel", vbNullString)
hChild = FindWindowEx(hParent, 0&, "TPanel", vbNullString)
hParent = FindWindowEx(hParent, hChild, "TPanel", vbNullString)
hChild = FindWindowEx(hParent, 0&, "TToolbar", vbNullString)

If hChild <> 0 Then
Call SendMessage(hChild, TB_PRESSBUTTON, 0, 0)
End If
End If
End Sub

Clicking In Another Application
Hello,

If there anyway i can make my application type into another application and click submit on the other one?? Like i want to mirror what is happening. Hard to explain but tell me if this makes no sense

There is a server manager i want to be able to send custom messages at certain time.

thanks,

Ross

Clicking On A Button Inside A Website
Hello all i am in need of clicking on a button within a website using a command button on my form. Once the website loads i want the user to be able to click the form button and it act like the user just clicked on the button inside the website.

Here is the button code form the website.

Code:
<input class="cdOBtn" type="button" value="Download Now" id="obtnDownload" name="obtnDownload" onclick="Download()" onkeypress="if (window.event.keyCode == 13) Download();" />
Any help would be great!

David

Clicking On A Button In A Form By Class Or Name
Hey all i am trying my best to figure out why my code below will not "click" on the submit button on this website...

Code:
<button type="submit" name="login" title="Continue" tabindex="3" class="gobutton"><span><span>SubmitIT</span></span></button>
i have tried the following:

Code:
WebBrowser1.Document.getElementsByName("login").Click
WebBrowser1.Document.getElementsByTagName("button").Click
WebBrowser1.Document.Forms("login").submit
But none of them does the trick.... Is there any other ways?

David

Clicking The Logon Button Automatically
Hey,

By using the VB webbrowser tool I am able to enter the username and the password to the required field. Now i need to run the function in the "login" button via VB.exe. so that i could login automatically, without having to press the login button. please help me. I need to help really urgently! I will be glad if you could provide some examples, tutorials and all.

Thank you

Copyright © 2005-08 www.BigResource.com, All rights reserved