Consultor Eletrônico



Kbase 17542: How to Call WIN32 API Function: GetParent
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/05/1998
How to Call WIN32 API Function: GetParent

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 API function
called GetParent. This function retrieves a handle to the window that
is the owner of the given window. A parent window has child windows,
and a child window can be a parent window for other child windows.

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


DEFINE VARIABLE hdlParent AS INTEGER NO-UNDO.

PROCEDURE GetParent EXTERNAL "USER32.DLL":
DEFINE INPUT PARAMETER hdlToWindow AS LONG.
DEFINE RETURN PARAMETER hdlToParentWindow AS LONG.
END PROCEDURE.


RUN GetParent (INPUT DEFAULT-WINDOW:HWND, OUTPUT hdlParent).

IF hdlParent <> 0 THEN
MESSAGE "Parent Window Handle Retrieved" VIEW-AS ALERT-BOX.
ELSE
MESSAGE "Given Window Has No Parent" VIEW-AS ALERT-BOX.

Progress Software Technical Support Note # 17542