test: winable.c Source File

Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# winable.c

Go to the documentation of this file.

    00001 /****************************** Module Header ******************************\
    00002 * Module Name: winable.c
    00003 *
    00004 * Copyright (c) 1985 - 1999, Microsoft Corporation
    00005 *
    00006 * This module contains
    00007 *
    00008 * History:
    00009 * 20-Feb-1992 DarrinM   Pulled functions from user\server.
    00010 \***************************************************************************/
    00011
    00012 #include "precomp.h"
    00013 #pragma hdrstop
    00014
    00015 /***************************************************************************\
    00016 *
    00017 * GetWindowInfo()
    00018 * PRIVATE
    00019 *
    00020 * Gets information about a window in one self-consistent big block.
    00021 *
    00022 \***************************************************************************/
    00023 BOOL WINAPI
    00024 GetWindowInfo(HWND hwnd, PWINDOWINFO pwi)
    00025 {
    00026     PWND pwnd;
    00027     UINT cBorders;
    00028     PCLS pclsT;
    00029
    00030     if (pwi->cbSize != sizeof(WINDOWINFO)) {
    00031         RIPERR1(ERROR_INVALID_PARAMETER, RIP_WARNING, "WINDOWINFO.cbSize %d is wrong", pwi->cbSize);
    00032     }
    00033     /*
    00034      * Validate the window
    00035      */
    00036     pwnd = ValidateHwnd(hwnd);
    00037
    00038     if (pwnd == NULL) {
    00039         return FALSE;
    00040     }
    00041
    00042     try {
    00043         // Window rect
    00044         pwi->rcWindow = pwnd->rcWindow;
    00045
    00046         // Client rect
    00047         pwi->rcClient = pwnd->rcClient;
    00048
    00049         // Style
    00050         pwi->dwStyle = pwnd->style;
    00051         pwi->dwExStyle = pwnd->ExStyle;
    00052         pwi->dwWindowStatus = 0;
    00053         if (TestWF(pwnd, WFFRAMEON))
    00054             pwi->dwWindowStatus |= WS_ACTIVECAPTION;
    00055
    00056         // Borders
    00057         cBorders = GetWindowBorders(pwnd->style, pwnd->ExStyle, TRUE, FALSE);
    00058         pwi->cxWindowBorders = cBorders * SYSMET(CXBORDER);
    00059         pwi->cyWindowBorders = cBorders * SYSMET(CYBORDER);
    00060
    00061         // Type
    00062         pclsT = (PCLS)REBASEALWAYS(pwnd, pcls);
    00063         pwi->atomWindowType = pclsT->atomClassName;
    00064
    00065         // Version
    00066         if (TestWF(pwnd, WFWIN50COMPAT)) {
    00067             pwi->wCreatorVersion = VER50;
    00068         } else if (TestWF(pwnd, WFWIN40COMPAT)) {
    00069             pwi->wCreatorVersion = VER40;
    00070         } else if (TestWF(pwnd, WFWIN31COMPAT)) {
    00071             pwi->wCreatorVersion = VER31;
    00072         } else {
    00073             pwi->wCreatorVersion = VER30;
    00074         }
    00075     } except (W32ExceptionHandler(FALSE, RIP_WARNING)) {
    00076         RIPERR1(ERROR_INVALID_WINDOW_HANDLE,
    00077                 RIP_WARNING,
    00078                 "Window %x no longer valid",
    00079                 hwnd);
    00080         return FALSE;
    00081     }
    00082
    00083     return TRUE;
    00084 }