-
Dec 1st, 2006, 12:10 AM
#1
Thread Starter
Junior Member
Raising JavaScript Event from VB6
I used WebBrower to navigate and have a Web page visible which has JavaScript MouseClick events. I want to be able to trigger these events from VB6 code. Can this be done.
The thread.php?t=368471 is similar. That is:
VB Code:
Private Sub Control_MouseMove(ByVal sender As Object, _
ByVal e As System.Windows.Forms.MouseEventArgs) Handles mouseMove, Button1.MouseMove.
Console.WriteLine("Control_MouseMove: " & DirectCast(sender, Control).Name)
End Sub
What do I use as the 'Panel1', 'sender' and 'Control' equivalent from the JavaScript.
Good software like good food takes time to prepare.
Winnie-the-Pough (sic)
-
Dec 1st, 2006, 12:23 AM
#2
Re: Raising JavaScript Event from VB6
You probably need to get familiar with DOM handling via VB6. When you push F2, you see the Object Browser. You can take a look into the WebBrowser components that are provided, these allow you to create new elements and possibly to trigger events as well; for the least you should be able to add custom code into the page, meaning you can add more JavaScript.
It might be hard though, so you'll need patience and a good bit of reading on the forums and via Google I don't have any of this in fresh memory so I can't help more than this.
-
Dec 1st, 2006, 04:20 AM
#3
Re: Raising JavaScript Event from VB6
This seems like .NET code... If so, you'll get much better responce in the forums .NET section.
-
Dec 5th, 2006, 09:45 PM
#4
Thread Starter
Junior Member
Re: Raising JavaScript Event from VB6
While searching for information on DOM as suggested in one of the above responses, I found this:
http://keyword.netscape.com/ns/boom...?query=ms759132
which explains clone Method
Clones a copy of the current IXMLDOMSelection, with the same position and context.
Code:
Dim xmlDoc As New Msxml2.DOMDocument30 Dim xpath As IXMLDOMSelection Dim xpath2 As IXMLDOMSelection Dim temp1 As IXMLDOMNode Dim temp2 As IXMLDOMNode xmlDoc.loadXML ("<root><elem1>Hello</elem1><elem2>World!</elem2></root>") If (xmlDoc.parseError.errorCode <> 0) Then Dim myErr Set myErr = xmlDoc.parseError MsgBox("You have error " & myErr.reason) Else ' Create an XMLDOMSelection object from selected nodes. Set xpath = xmlDoc.selectNodes("root/elem1") ' Cache the XPath expression and context. xpath.expr = "root/elem1" Set xpath.context = xmlDoc ' Clone the XMLDOMSelection object. Set xpath2 = xpath.Clone() Set temp1 = xpath.peekNode() ' temp1 == <elem1/> MsgBox("temp1: " & temp1.xml) Set temp2 = xpath2.peekNode() ' temp2 == <elem1/> MsgBox("temp2: " & temp2.xml) ' Note that position and context are maintained. End If
It appears to me that this allows me to fetch the value from the screen DOM that is written by the JavaScript of the xmlDoc.loadXML. I had been using innerbody for this purpose. ( I assume I need to include more of the original JavaScript in my VB6 clone, as the clone needs to know the other properties, e.g. location, etc. )
I find no examples of being able to Poke text using this or similar method. Is that possible? I am not asking for code, I want a simple Yes or No on the Poke, unless the problem is more involved and someone has a ready solution.
My original question was to be able to simulate a click without having to locate the positon on the screen.
I can find the line in the JavaScript that initiates the 'onKeyUp=..."
Can I somehow simulate that with a variation of the clone Method?
I need more help on this last question than a Yes Or No.
Thanks
Winnie-the-Pough
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|