hello i used this vb6 code in order to get the handle of any window from a point.
VB Code:
  1. Dim myhwnd As Long
  2.     Dim typPt As POINTAPI
  3.     Dim hwnd As Long
  4.      typPt.x = MY_X
  5.      typPt.y = MY_Y
  6.     myhwnd = WindowFromPoint(typPt.x, typPt.y)
now the problem is that this code seems not to work with vb.net.
I could get a handle to any window even if it did not belong to the form.
Now the following code can find the handle a control that does only exist on the form ,i think. Is there a way to get a handle to any control of any windows window ?

thanks !


VB Code:
  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2.         Dim pt As System.Drawing.Point
  3.         pt.X = 500
  4.         pt.Y = 100
  5.         Dim co As Control
  6.         co = Me.GetChildAtPoint(pt)
  7.         If Not co Is Nothing Then
  8.             MsgBox(co.Name)
  9.         Else
  10.             MsgBox("NO CONTROL FOUND", MsgBoxStyle.ApplicationModal)
  11.         End If
  12.  
  13.  
  14.     End Sub