Table of Contents

HANDLEBYCURSOR method (System)

Description

This method returns the handle (HWND) of a GUI object underneath the cursor.

Syntax

Hwnd = Exec_Method( "SYSTEM", "HANDLEBYCURSOR", ScreenXY, FormOnly, DPIObject )

Parameters

NameRequiredDescription
ScreenXYNoScreen coordinates to use for the search. If these are not passed the current cursor position is used.
FormatOnlyNoIf TRUE$ then this method returns the handle of the parent form under the cursor, rather than any child windows.
DPIObjectNoContains the name of a GUI object (control or form) to use for DPI scaling. If this parameter is passed then the ScreenXY is considered to be scaled to the DPIObject’s DPI (i.e. DIPs rather than pixels), and the ScreenXY will be converted to pixels before the search is made.



This parameter is ignored if the ScreenXY parameter is not passed.

Returns

The handle (HWND) of the GUI object under the cursor (or passed screen coordinates). This handle can be a non-PS object.

Remarks

This method is essentially a wrapper around the Windows API ChildWindowFromPoint function – for further information please see the MSDN website.

Example

 
// Example - find the object under the screen cursor and check if it's a

   // PS object.

   

   hwndHot = Exec_Method( "SYSTEM", "HANDLEBYCURSOR", "", "", "" )

   

   if hwndHot then

      hotID = Exec_Method( "SYSTEM", "OBJECTID", hwndHot )

      if bLen( hotID ) then

         // We have a PS object underneath the cursor

      end

   end
 
 
 

See Also

OBJECTBYCURSOR method, OBJECTID method, Common GUI HANDLE property.