GetWindowOrg

2.x

  DWORD GetWindowOrg(hdc)    
  HDC hdc; /* handle of device context */

The GetWindowOrg function retrieves the x- and y-coordinates of the origin of the window associated with the given device context.

Parameters

hdc

Identifies the device context.

Return Value

The low-order word of the return value contains the logical x-coordinate of the window's origin, if the function is successful; the high-order word contains the y-coordinate.

Example

The following example uses the GetWindowOrg function and the LOWORD and HIWORD macros to retrieve the x- and y-coordinates for the window origin:

HDC  hdc;
DWORD dw;
int xWindOrg, yWindOrg;

hdc = GetDC(hwnd);
dw  = GetWindowOrg(hdc);
ReleaseDC(hwnd, hdc);
xWindOrg = LOWORD(dw);
yWindOrg = HIWORD(dw);

See Also

GetViewportOrg, SetWindowOrg