SetWindowOrgEx function (wingdi.h)

The SetWindowOrgEx function specifies which window point maps to the viewport origin (0,0).

Syntax

BOOL SetWindowOrgEx(
  [in]  HDC     hdc,
  [in]  int     x,
  [in]  int     y,
  [out] LPPOINT lppt
);

Parameters

[in] hdc

A handle to the device context.

[in] x

The x-coordinate, in logical units, of the new window origin.

[in] y

The y-coordinate, in logical units, of the new window origin.

[out] lppt

A pointer to a POINT structure that receives the previous origin of the window, in logical units. If lpPoint is NULL, this parameter is not used.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.

Remarks

This helps define the mapping from the logical coordinate space (also known as a window) to the device coordinate space (the viewport). SetWindowOrgEx specifies which logical point maps to the device point (0,0). It has the effect of shifting the axes so that the logical point (0,0) no longer refers to the upper-left corner.


//map the logical point (xWinOrg, yWinOrg) to the device point (0,0) 
SetWindowOrgEx (hdc, xWinOrg, yWinOrg, NULL)

This is related to the SetViewportOrgEx function. Generally, you will use one function or the other, but not both. Regardless of your use of SetWindowOrgEx and SetViewportOrgEx, the device point (0,0) is always the upper-left corner.

Requirements

Requirement Value
Minimum supported client Windows 2000 Professional [desktop apps only]
Minimum supported server Windows 2000 Server [desktop apps only]
Target Platform Windows
Header wingdi.h (include Windows.h)
Library Gdi32.lib
DLL Gdi32.dll

See also

Coordinate Space and Transformation Functions

Coordinate Spaces and Transformations Overview

GetViewportOrgEx

GetWindowOrgEx

POINT

SetViewportOrgEx