Jump to content

WinSetOwner

From EDM2
Revision as of 01:38, 9 April 2025 by Martini (talk | contribs) (Created page with "This function changes the owner window of a specified window. ==Syntax== WinSetOwner(hwnd, hwndNewOwner) ==Parameters== ;hwnd (HWND) - Input: Window handle whose owner window is to be changed. ;hwndNewOwner (HWND) - Input: Handle of the new owner. :;NULLHANDLE:: The window becomes "disowned". :;Other:: Handle of the new owner window. ==Returns== ;rc (BOOL) - Returns: Success indicator. :;TRUE: Successful completion. :;FALSE: Error occurred. ==Remarks== The...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

This function changes the owner window of a specified window.

Syntax

WinSetOwner(hwnd, hwndNewOwner)

Parameters

hwnd (HWND) - Input
Window handle whose owner window is to be changed.
hwndNewOwner (HWND) - Input
Handle of the new owner.
NULLHANDLE
: The window becomes "disowned".
Other
: Handle of the new owner window.

Returns

rc (BOOL) - Returns
Success indicator.
TRUE
Successful completion.
FALSE
Error occurred.

Remarks

The old owner window is not locked by this function. The WinQueryWindow function can be used to get the handle of the owner window.

Errors

Possible returns from WinGetLastError:

PMERR_INVALID_HWND (0x1001)
An invalid window handle was specified.

Example Code

#define INCL_WINWINDOWMGR /* Or use INCL_WIN, INCL_PM, */
#include <os2.h>

HWND     hwnd;          /* Window handle whose owner window is to be changed. */
HWND     hwndNewOwner;  /* Handle of the new owner. */
BOOL     rc;            /* Success indicator. */

rc = WinSetOwner(hwnd, hwndNewOwner);

This example uses the WinSetOwner call to "disown" a window.

#define INCL_WINWINDOWMGR
#include <OS2.H>

HWND hwnd;    /* window handles. */
WinSetOwner(hwnd,(HWND)0);

Related Functions