Forget.... Very dificult....
Retrieveing screen position of HTML tags
Example: get screen position (x,y) of user login box on the right top of this page.
Iit´s possible?
I found something like that:
IHTMLElement
IHTMLBodyElement
IHTMLTextContainer
get_scrollLeft()
get_scrollTop()
:afrog:
Re: Forget.... Very dificult....
Try this. You need two Labels & a Timer control.
Code:
Option Explicit
Dim z As POINTAPI ' Declare variable
Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Type POINTAPI ' Declare Types
X As Long
Y As Long
End Type
Private Sub Form_Load()
Timer1.Interval = 100
End Sub
Private Sub Timer1_Timer()
GetCursorPos z ' Get coordinates
Label1 = "x: " & z.X ' Get x coordinates
Label2 = "y: " & z.Y ' Get y coordinates
' If z.X > 383 Then Beep ' Beep if x is greater than 383
End Sub
Re: Forget.... Very dificult....
I appreciate your reply, but I want an automated process.
I dont want to move the cursor to the specified position to retrieve x,y.
I want something like that:
Enter URL: http://www.blablabla.com [Proceed]
Answer: The first text box has position 328,123
By the way, Thanks alot. :)
Re: Forget.... Very dificult....
I'm very curious why the regular cast of characters have not posted to this thread and this has made me suspicious. I need Mod input before I go any further.
Re: Forget.... Very dificult....
Remember: diferent people have diferent monitor configurations, so the position may change...
... and sorry my terrible english: I say "I want this", "I want that", and it means I need this, I need that.
Thank you all and still waiting for answers.:wave:
Re: Forget.... Very dificult....
Using WebBrowser control:
Code:
Option Explicit
Private Sub Form_Load()
WebBrowser1.Navigate2 "http://www.vbforums.com/"
End Sub
Private Sub Form_Resize()
If WindowState <> vbMinimized Then WebBrowser1.Move 0, 0, ScaleWidth, ScaleHeight
End Sub
Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
With WebBrowser1.Document.getElementsByName("IC_QueryText")(0)
MsgBox "Internet.com search box is located at " & .offsetLeft & " x " & .offsetTop
End With
End Sub
There is also getElementsByTagName to which you can enter values such as input or textarea. getElementById returns only one specific element.