Code:
' add a DECLARE of convenience, subject to limitations below: DECLARE FUNCTION ChildWindowFromPointAPI LIB "USER32.DLL" ALIAS "ChildWindowFromPoint" _ (BYVAL hwndParent AS DWORD, BYVAL pt AS POINTAPI) AS DWORD .... LOCAL Pt AS POINTAPI, hCtrl AS LONG, ctrlId AS LONG CASE %WM_SETCURSOR (or whenever) GetCursorPos pt ScreenToClient CBHNDL, pt hCtrl = ChildWindowfromPointApi (CBHNDL, pt) ' See notes IF ISTRUE hCtrl THEN IF hCtrl = CBHNDL THEN ' cursor is within screen boundaries, but not over a control ELSE CtrlId = GetDlgCtrlId (hCtrl) ' control ID END IF ELSE cursor is not within the boundaries of screen 'CBHNDL' which can occur if the mouse has been captured and dragged off. END IF
If older compiler - or you just feel like it - you can use this declare (included in Win32API.INC) and this call:
Code:
DECLARE FUNCTION ChildWindowFromPoint LIB "USER32.DLL" ALIAS "ChildWindowFromPoint" _ (BYVAL hwndParent AS DWORD, BYVAL x AS LONG, BYVAL y AS LONG) AS DWORD ....... hCtrl = ChildWindowFromPoint (CBHNDL, pt.x, pt.y)
MCM
Leave a comment: