Jump to content

WinWindowFromPoint: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
 
(2 intermediate revisions by the same user not shown)
Line 5: Line 5:


==Parameters==
==Parameters==
;hwndParent (HWND) - input
;hwndParent (HWND) - input:Window handle whose child windows are to be tested.
:Window handle whose child windows are to be tested.
:;HWND_DESKTOP:The desktop-window handle, implying that all main windows are tested. In this instance, pptlPoint must be relative to the bottom left corner of the screen.
 
:;Other:Parent-window handle.
:;HWND_DESKTOP
;pptlPoint (PPOINTL) - input:The point to be tested.
::The desktop-window handle, implying that all main windows are tested. In this instance, pptlPoint must be relative to the bottom left corner of the screen.  
:Specified in window coordinates relative to the window specified by the hwndParent parameter.
:;Other
;fEnumChildren (BOOL) - input:Test control.
::Parent-window handle.  
::TRUE - Test all the descendant windows, including child windows of child windows
 
::FALSE - Test only the immediate child windows.
;pptlPoint (PPOINTL) - input
:The point to be tested.
:Specified in window coordinates relative to the window specified by the hwndParent parameter.  
 
;fEnumChildren (BOOL) - input
:Test control.
 
:;TRUE
::Test all the descendant windows, including child windows of child windows  
:;FALSE
::Test only the immediate child windows.


==Returns==
==Returns==
; hwndFound (HWND) - returns
;hwndFound (HWND) - returns:Window handle beneath pptlPoint.
:Window handle beneath pptlPoint.
::NULLHANDLE - pptlPoint is outside hwndParent
 
::Parent - pptlPoint is not inside any of the children of hwndParent
:;NULLHANDLE
::Other - Window handle is beneath pptlPoint.
::pptlPoint is outside hwndParent  
:;Parent
::pptlPoint is not inside any of the children of hwndParent  
:;Other
::Window handle is beneath pptlPoint.  


==Errors==
==Errors==
Possible returns from WinGetLastError
Possible returns from WinGetLastError
;PMERR_INVALID_HWND (0x1001)
;PMERR_INVALID_HWND (0x1001):An invalid window handle was specified.
:An invalid window handle was specified.


==Remarks==
==Remarks==
This function checks only the descendants of the specified window.  
This function checks only the descendants of the specified window.


==Example Code==
==Example Code==
Line 48: Line 31:
<pre>
<pre>
#define INCL_WINWINDOWMGR
#define INCL_WINWINDOWMGR
#include <OS2.H>
#include <os2.h>
 
HWND hwndunderneath;
HWND hwndunderneath;
POINTL point = { 100L, 100L};
POINTL point = {100L, 100L};
hwndunderneath = WinWindowFromPoint(HWND_DESKTOP,
hwndunderneath = WinWindowFromPoint(HWND_DESKTOP,
                                     &point,
                                     &point,
Line 57: Line 41:
                                             /* the main        */
                                             /* the main        */
                                             /* windows.        */
                                             /* windows.        */
</pre>
Definition
<pre>
#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, */
#include <os2.h>
HWND      hwndParent;    /*  Window handle whose child windows are to be tested. */
PPOINTL    pptlPoint;      /*  The point to be tested. */
BOOL      fEnumChildren;  /*  Test control. */
HWND      hwndFound;      /*  Window handle beneath pptlPoint. */
hwndFound = WinWindowFromPoint(hwndParent, pptlPoint, fEnumChildren);
</pre>
</pre>


Line 85: Line 54:
* WinQueryWindowRect
* WinQueryWindowRect
* WinWindowFromDC
* WinWindowFromDC
* WinWindowFromID  
* WinWindowFromID


[[Category:Win]]
[[Category:Win]]

Latest revision as of 01:16, 27 April 2024

This function finds the window below a specified point, that is a descendant of a specified window.

Syntax

WinWindowFromPoint(hwndParent, pptlPoint, fEnumChildren)

Parameters

hwndParent (HWND) - input
Window handle whose child windows are to be tested.
HWND_DESKTOP
The desktop-window handle, implying that all main windows are tested. In this instance, pptlPoint must be relative to the bottom left corner of the screen.
Other
Parent-window handle.
pptlPoint (PPOINTL) - input
The point to be tested.
Specified in window coordinates relative to the window specified by the hwndParent parameter.
fEnumChildren (BOOL) - input
Test control.
TRUE - Test all the descendant windows, including child windows of child windows
FALSE - Test only the immediate child windows.

Returns

hwndFound (HWND) - returns
Window handle beneath pptlPoint.
NULLHANDLE - pptlPoint is outside hwndParent
Parent - pptlPoint is not inside any of the children of hwndParent
Other - Window handle is beneath pptlPoint.

Errors

Possible returns from WinGetLastError

PMERR_INVALID_HWND (0x1001)
An invalid window handle was specified.

Remarks

This function checks only the descendants of the specified window.

Example Code

This example calls WinWindowFromPoint to find out if any main windows are beneath point 100,100.

#define INCL_WINWINDOWMGR
#include <os2.h>

HWND hwndunderneath;
POINTL point = {100L, 100L};
hwndunderneath = WinWindowFromPoint(HWND_DESKTOP,
                                    &point,
                                    FALSE); /* do not test the */
                                            /* descendants of  */
                                            /* the main        */
                                            /* windows.        */

Related Functions

  • WinEnableWindow
  • WinIsThreadActive
  • WinIsWindow
  • WinIsWindowEnabled
  • WinQueryDesktopWindow
  • WinQueryObjectWindow
  • WinQueryWindowDC
  • WinQueryWindowProcess
  • WinQueryWindowRect
  • WinWindowFromDC
  • WinWindowFromID