Changeset 755 for trunk/src


Ignore:
Timestamp:
Aug 31, 1999, 4:39:40 PM (26 years ago)
Author:
sandervl
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/user32/user32.cpp

    r577 r755  
    1 /* $Id: user32.cpp,v 1.21 1999-08-19 12:53:55 sandervl Exp $ */
     1/* $Id: user32.cpp,v 1.22 1999-08-31 14:37:27 sandervl Exp $ */
    22
    33/*
     
    12661266    return O32_ChildWindowFromPoint(arg1, arg2);
    12671267}
    1268 //******************************************************************************
    1269 //******************************************************************************
    1270 HWND WIN32API ChildWindowFromPointEx(HWND arg1, POINT arg2, UINT uFlags)
    1271 {
    1272 #ifdef DEBUG
    1273     WriteLog("USER32:  ChildWindowFromPointEx, not completely supported!\n");
    1274 #endif
    1275     return O32_ChildWindowFromPoint(arg1, arg2);
     1268/*****************************************************************************
     1269 * Name      : HWND WIN32API ChildWindowFromPointEx
     1270 * Purpose   : The GetWindowRect function retrieves the dimensions of the
     1271 *             bounding rectangle of the specified window. The dimensions are
     1272 *             given in screen coordinates that are relative to the upper-left
     1273 *             corner of the screen.
     1274 * Parameters:
     1275 * Variables :
     1276 * Result    : If the function succeeds, the return value is the window handle.
     1277 *             If the function fails, the return value is zero
     1278 * Remark    :
     1279 * Status    : FULLY IMPLEMENTED AND TESTED
     1280 *
     1281 * Author    : Rene Pronk [Sun, 1999/08/08 23:30]
     1282 *****************************************************************************/
     1283
     1284
     1285HWND WIN32API ChildWindowFromPointEx (HWND hwndParent, POINT pt, UINT uFlags)
     1286{
     1287        RECT rect;
     1288        HWND hWnd;
     1289        POINT absolutePt;
     1290
     1291        dprintf(("USER32: ChildWindowFromPointEx(%08xh,%08xh,%08xh).\n",
     1292                 hwndParent, pt, uFlags));
     1293
     1294        if (GetWindowRect (hwndParent, &rect) == 0) {
     1295                // oops, invalid handle
     1296                return NULL;
     1297        }
     1298
     1299        // absolutePt has its top in the upper-left corner of the screen
     1300        absolutePt = pt;
     1301        ClientToScreen (hwndParent, &absolutePt);
     1302
     1303        // make rect the size of the parent window
     1304        GetWindowRect (hwndParent, &rect);
     1305        rect.right = rect.right - rect.left;
     1306        rect.bottom = rect.bottom - rect.top;
     1307        rect.left = 0;
     1308        rect.top = 0;
     1309
     1310        if (PtInRect (&rect, pt) == 0) {
     1311                // point is outside window
     1312                return NULL;
     1313        }
     1314
     1315        // get first child
     1316        hWnd = GetWindow (hwndParent, GW_CHILD);
     1317
     1318        while (hWnd != NULL) {
     1319
     1320                // do I need to skip this window?
     1321                if (((uFlags & CWP_SKIPINVISIBLE) &&
     1322                     (IsWindowVisible (hWnd) == FALSE)) ||
     1323                    ((uFlags & CWP_SKIPDISABLED) &&
     1324                     (IsWindowEnabled (hWnd) == FALSE)) ||
     1325                    ((uFlags & CWP_SKIPTRANSPARENT) &&
     1326                     (GetWindowLongA (hWnd, GWL_EXSTYLE) & WS_EX_TRANSPARENT)))
     1327
     1328                {
     1329                        hWnd = GetWindow (hWnd, GW_HWNDNEXT);
     1330                        continue;
     1331                }
     1332
     1333                // is the point in this window's rect?
     1334                GetWindowRect (hWnd, &rect);
     1335                if (PtInRect (&rect, absolutePt) == FALSE) {
     1336                        hWnd = GetWindow (hWnd, GW_HWNDNEXT);
     1337                        continue;
     1338                }
     1339
     1340                // found it!
     1341                return hWnd;
     1342        }
     1343
     1344        // the point is in the parentwindow but the parentwindow has no child
     1345        // at this coordinate
     1346        return hwndParent;
    12761347}
    12771348//******************************************************************************
Note: See TracChangeset for help on using the changeset viewer.