Jump to content

WinWindowFromPoint: Difference between revisions

From EDM2
Ak120 (talk | contribs)
mNo edit summary
Ak120 (talk | contribs)
Line 31: 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 40: 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>



Revision as of 20:13, 21 November 2023

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