Consultor Eletrônico



Kbase 19361: How to Call WIN32 API Function: IsChild
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   12/29/1999
DISCLAIMER:
===========
The code example in this knowledgebase is for informational purposes only. If you have specific questions about which API calls would be best suited to your design goals, please consult your Microsoft documentation.

INTRODUCTION:
=============
The following sample code shows how to call the Win32 APU function called IsChild. This function checks to see if a window is a direct descendant for the given parent window. A child window is a direct descendant if the parent window handle that was given when CreateWindow() created the child window, is the same as the parent window handle used with the IsChild() function. For dialog boxes, the dialog controls are direct descendants of the dialog box window.

This code has been tested on Windows NT 4.0 Workstation only.


DEFINE VARIABLE iRC AS INTEGER NO-UNDO.

PROCEDURE IsChild EXTERNAL "USER32.DLL":
DEFINE INPUT PARAMETER hParent AS LONG NO-UNDO.
DEFINE INPUT PARAMETER hQuestionableChild AS LONG NO-UNDO.
DEFINE RETURN PARAMETER iRC AS LONG NO-UNDO.
END PROCEDURE.

RUN IsChild (SomeWindow:HWND, SomeQuestionableChild:HWND, OUTPUT iRC).

IF iRC = 0 THEN
MESSAGE "No Child Relationship Found" VIEW-AS ALERT-BOX.
ELSE
MESSAGE "Window is a Child of the Given Parent" VIEW-AS ALERT-BOX.