Solved

API for IE to get 'Java' button clicked

Posted on 2001-06-04
13
198 Views
Last Modified: 2008-02-01
In my VB6 program I am trying to identify and click on a button on a web page displayed through IE (5.5).
I can identify and get a handle on the window and its children windows obviuosly through APIs. However, the buton, I need to simulate to click on, is a java script(function) and I am not sure if it is seen by the NT4 w/station as a seperate window object.
Is there a way to simulate a click on that button through VB6?
Any ideas??

Thanks in advance
David
0
Comment
Question by:kotdl1
13 Comments
 
LVL 28

Expert Comment

by:AzraSound
ID: 6154496
what is the ultimate goal?  to post information?  where did this IE window originate from?  if you did not automate it yourself, how are you determining for sure that you have located, and are using, the correct IE window?
0
 

Author Comment

by:kotdl1
ID: 6154845
AzraSound,
I find the window through the API with 'Function FindWin(Class As String, Caption As String) As Long' loading it with the Caption string as the window is already open. I can automate it from my program but this is not the real issue.
Then the FINDWINEX is used to find the child windows. But i can do any other way if you have better sugestion.

The challenge is in identifying this JAVA button.

Thanks for the interests.

David
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 6155847
ok, first see if you can implement this code to get the DOM from the window:
http://www.domaindlx.com/e_morcillo/scripts/showtip.asp?tip=iedom


once we have that, we can iterate through the objects on the page and do as we like.  the reason for my questions above is b/c often people simply want to post data to a website via a submit button or the like and feel they must automate a user clicking the button.
0
Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

 

Author Comment

by:kotdl1
ID: 6158134
HI there,

It is done.
not familiar with the IID_IHTMLDocument, etc so I need some guidance there as to what to do with it
If not a link to read on these functions can help.

Thanks AGAIN

David

0
 

Author Comment

by:kotdl1
ID: 6158148
AzraSound,

I just reread your comments(last). 'and feel they must automate a user clicking the button'
Well, it is a similar request, really. Except in our case the button is 'a java script button'.

I hope you understand what I am saying here??

Thanks
David
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 6158244
what is the html for this button that needs to be clicked?   something like:

<input type="button" name="btnDoThis" value="Click Me">


and what occurs once this button is clicked?
0
 

Author Comment

by:kotdl1
ID: 6158319
No,
like

javascript:RefreshPage('commodity.asp?group=INT&exchange=..')

this is on one line

Basically, it is refreshing a page but not the whole page ie I should not use the "REFRESH" button on the window menu bar... or that should be the last resort(if we can't do it easily).

The option is I can send the CGI script to get this Web page refreshed ( I think I can do it, it just occured to me). It will be an equivalent to REFRESH button clicked and with the specific script it may work.



Looking forward to your response.
Thanks

0
 
LVL 28

Accepted Solution

by:
AzraSound earned 100 total points
ID: 6161836
>>The option is I can send the CGI script to get this Web page refreshed

yes, i was thinking about something along those lines.  otherwise, we may try and utilize the document object of the explorer window to invoke the javascript function ourselves, e.g.:

Call WebBrowser1.Document.parentWindow.execScript("ShowAlert('Testing')", "JavaScript")

which shows, had you been using a webbrowser control, how to invoke a function called ShowAlert and passing it the parameter "Testing".  first see if you are allowed to do this using the IHTMLDocument object you get back from the function above, e.g.,

Dim htmlDoc As IHTMLDocument
Set htmlDoc = IEDOMFromHWnd(...)
Call htmlDoc.parentWindow.execScript("RefreshPage(''commodity.asp?group=INT&exchange=..')", "JavaScript")

otherwise, i have another method by which you can find this IE window and then call that above line of code.  if all else fails, perhaps we can try the CGI approach.
0
 

Author Comment

by:kotdl1
ID: 6161860
You are a real CHAMP...
I will try it later on and let you know..

THANKS AGAIN

David
0
 
LVL 27

Expert Comment

by:Asta Cu
ID: 6906999
Please update the expert here who have so willingly stepped in to help you, since much time has passed since your last comments, and Email notifications may not have been generated to the participating experts here due to some problems at that time.  If you've been helped, accept the respective question by that expert to grade and close it.

Somewhat off-topic, but important.

****************************** ALERT********************************
WindowsUpdate - Critical Update alert March 28, 2002 from Microsoft
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/security/bulletin/ms02-015.asp
Synopsis:
Microsoft Security Bulletin MS02-015  
28 March 2002 Cumulative Patch for Internet Explorer
Originally posted: March 28, 2002
Summary
Who should read this bulletin: Customers using Microsoft® Internet Explorer
Impact of vulnerability: Two vulnerabilities, the most serious of which would allow script to run in the Local Computer Zone.
Maximum Severity Rating: Critical
Recommendation: Consumers using the affected version of IE should install the patch immediately.
Affected Software:
Microsoft Internet Explorer 5.01
Microsoft Internet Explorer 5.5
Microsoft Internet Explorer 6.0

Thought you'd appreciate knowing this.
":0)
Asta
0
 

Author Comment

by:kotdl1
ID: 6909541
Astaec,

I have been around the world in my applications - sorry about it.
Now, I have a problem with:
Dim htmlDoc As IHTMLDocument
Set htmlDoc = IEDOMFromHWnd(...)

Not sure how you wnat me to get IEDOMFrom... ??
Do I need to ahve another reference - i have already the IHTMLDocument.???
THANKS
0
 
LVL 16

Expert Comment

by:twalgrave
ID: 7707616
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!

No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in Community Support that this question is:
- points to AzraSound
Please leave any comments here within the
next seven days.
0
 

Expert Comment

by:modulo
ID: 7758268
Finalized as proposed

modulo

Community Support Moderator
Experts Exchange
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

828 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