# 2.1.25.35 GetWindow

## Description

The GetWindow function retrieves a handle to a window that has the specified relationship (Z order or owner) to the specified window.

get Origin window handle

## Syntax

HWND GetWindow( HWND hWnd, UINT uCmd )

HWND GetWindow( int nWin = OGW_MAIN )

## Parameters

hWnd
[input] Handle to a window. The window handle retrieved is relative to this window, based on the value of the uCmd parameter.
uCmd
[input]Specifies the relationship between the specified window and the window whose handle is to be retrieved. This parameter can be one of the following values.
GW_CHILD The retrieved handle identifies the child window at the top of the Z order, if the specified window is a parent window; otherwise, the retrieved handle is NULL.
The function examines only child windows of the specified window. It does not examine descendant windows.
GW_HWNDFIRST The retrieved handle identifies the window of the same type that is highest in the Z order.
GW_HWNDLAST The retrieved handle identifies the window of the same type that is lowest in the Z order.
GW_HWNDNEXT The retrieved handle identifies the window below the specified window in the Z order.
GW_HWNDPREV The retrieved handle identifies the window above the specified window in the Z order.
GW_OWNER The retrieved handle identifies the specified window's owner window, if any.

nWin
[input] one of the OGW_MAIN, OGW_MDICLIENT, OGW_SCRIPT_WINDOW, OGW_OUTPUT_LOG, OGW_CODEBUILDER, OGW_DB_ACTIVE_DLG, OGW_NUM_WIN_TYPES.

## Return

The window handle of an Origin window.

## Examples

EX1

int GetWindow_ex1()
{
HWND    hwnd = GetWindow();
MessageBox(hwnd, "This is a test", "TestGetWindow");
return 1;
}

## Remark

retrieves the Windows handle of Origin's internal windows.