Results 1 to 2 of 2

Thread: Top window location

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2002
    Location
    San Jose
    Posts
    21

    Top window location

    Hi,
    I have a application which move the cursor to a web page button (x, y) and click to open a new page window (samll window). Then move cursor to a button on this new page and click. But how to located new top small window's (0, 0)? because it is not at same popup location each time. Thank you so much.

  2. #2
    Lively Member
    Join Date
    Feb 2001
    Location
    Sweden, Sthlm
    Posts
    112
    hi!!

    here is some code to determine the location and size of
    the foregroundwindow...

    Private Declare Function GetWindowRect Lib "user32.dll" (ByVal hWnd As Long, lpRect As RECT) As Long
    Private Declare Function GetForegroundWindow Lib "user32.dll" () As Long
    Private Type RECT
    left As Long
    top As Long
    right As Long
    bottom As Long
    End Type

    Private Sub Timer1_Timer()
    Dim r As RECT
    Dim hWnd As Long
    Dim ret As Long

    hWnd = GetForegroundWindow()
    ret = GetWindowRect(hWnd, r)

    Label1.Caption = "Left=" & r.left
    Label2.Caption = "right=" & r.right
    Label3.Caption = "top=" & r.top
    Label4.Caption = "bottom=" & r.bottom
    End Sub

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