00001 /****************************** Module Header ******************************\ 00002 * Module Name: help.c 00003 * 00004 * Copyright (c) 1985 - 1999, Microsoft Corporation 00005 * 00006 * This module contains the various rectangle manipulation APIs. 00007 * 00008 * History: 00009 * 23-May-95 BradG Created for Kernel mode 00010 \***************************************************************************/ 00011 00012 BOOL FIsParentDude(PWND pwnd) 00013 { 00014 return(TestWF(pwnd, WEFCONTROLPARENT) || TestWF(pwnd, WFDIALOGWINDOW) || 00015 ((GETFNID(pwnd) == FNID_BUTTON) && 00016 (TestWF(pwnd, BFTYPEMASK) == BS_GROUPBOX))); 00017 } 00018 00019 00020 /***************************************************************************\ 00021 * GetContextHelpId() 00022 * Given a pwnd, this returns the Help Context Id for that window; 00023 * Note: If a window does not have a Context Id of its own, then it inherits 00024 * the ContextId of it's parent, if it is a child window; else, from its owner, 00025 * it is a owned popup. 00026 \***************************************************************************/ 00027 00028 DWORD GetContextHelpId( 00029 PWND pwnd) 00030 { 00031 DWORD dwContextId; 00032 00033 while (!(dwContextId = (DWORD)(ULONG_PTR)_GetProp(pwnd, 00034 MAKEINTATOM(gpsi->atomContextHelpIdProp), PROPF_INTERNAL))) { 00035 pwnd = (TestwndChild(pwnd) ? 00036 REBASEPWND(pwnd, spwndParent) : 00037 REBASEPWND(pwnd, spwndOwner)); 00038 if (!pwnd || (GETFNID(pwnd) == FNID_DESKTOP)) 00039 break; 00040 } 00041 00042 return dwContextId; 00043 } 00044 00045 00046 00047 00048 /* 00049 * Dialog Child enumeration proc 00050 * 00051 * Enumerates children of a dialog looking for the child under the mouse. 00052 * 00053 */ 00054 BOOL CALLBACK EnumPwndDlgChildProc(PWND pwnd, LPARAM lParam) 00055 { 00056 PDLGENUMDATA pDlgEnumData = (PDLGENUMDATA)lParam; 00057 00058 if (pwnd != pDlgEnumData->pwndDialog && IsVisible(pwnd) && 00059 PtInRect(&((WND *)pwnd)->rcWindow, pDlgEnumData->ptCurHelp)) { 00060 /* 00061 * If it's a group box, keep enumerating. This takes care of 00062 * the case where we have a disabled control in a group box. 00063 * We'll find the group box first, and keep enumerating until we 00064 * hit the disabled control. 00065 */ 00066 pDlgEnumData->pwndControl = pwnd; 00067 return (FIsParentDude(pwnd)); 00068 } 00069 return TRUE; 00070 }