Results 1 to 6 of 6

Thread: Forget.... Very dificult....

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2009
    Posts
    4

    Thumbs down 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()


  2. #2
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    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??

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2009
    Posts
    4

    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.

  4. #4
    PowerPoster CDRIVE's Avatar
    Join Date
    Jul 2007
    Posts
    2,620

    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??

  5. #5

    Thread Starter
    New Member
    Join Date
    Jan 2009
    Posts
    4

    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.

  6. #6
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    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
  •  



Click Here to Expand Forum to Full Width