|
-
Jan 9th, 2009, 07:59 PM
#1
Thread Starter
New Member
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()
-
Jan 9th, 2009, 08:28 PM
#2
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
<--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
If topic has been resolved, please pull down the Thread Tools & mark it Resolved.
Is VB consuming your life, and is that a bad thing?? 
-
Jan 9th, 2009, 08:48 PM
#3
Thread Starter
New Member
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.
-
Jan 9th, 2009, 10:34 PM
#4
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.
<--- Did someone help you? Please rate their post. The little green squares make us feel really smart!
If topic has been resolved, please pull down the Thread Tools & mark it Resolved.
Is VB consuming your life, and is that a bad thing?? 
-
Jan 10th, 2009, 07:28 AM
#5
Thread Starter
New Member
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.
-
Jan 10th, 2009, 08:28 AM
#6
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.
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
|