Article ID: 161301
Article Last Modified on 7/1/2004
Declare Function WindowFromPointXY Lib "User32" _
Alias "WindowFromPoint" (ByVal xPoint As Long, _
ByVal yPoint As Long) As Long
Function VBWindowFromPoint(ByVal x As Long, ByVal y As Long) As Long
VBWindowFromPoint = WindowFromPointXY(x, y)
End Function
' Convert form coordinates to screen coordinates
screenX = X + Form1.Left / Screen.TwipsPerPixelX
screenY = Y + Form1.Top / Screen.TwipsPerPixelY
' Retrieve the window handle
hWindow = VBWindowFromPoint(screenX, screenY)
If hWindow = Form1.hWnd Then
MsgBox "Success"
End If
Additional query words: kbVBp500 kbVBp600 kbVBp kbdsd kbDSupport KBWIN32SDK KBAPI
Keywords: kbhowto KB161301