Solved

API for IE to get 'Java' button clicked

Posted on 2001-06-04
13
188 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
 

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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 

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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

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…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
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…

707 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

15 Experts available now in Live!

Get 1:1 Help Now