POINT Structure
The POINT
structure defines the x- and y-coordinates of a point.
Syntax
#include <windows.h>
typedef struct tagPOINT {
LONG x;
LONG y;
} POINT, *PPOINT;
Members
Member | Type | Description |
---|---|---|
x | LONG | Horizontal (x) coordinate. |
y | LONG | Vertical (y) coordinate. |
Remarks
The POINT
structure is used extensively throughout the Windows API to represent a location in a two‑dimensional space, such as a window's client area, a cursor position, or a rectangle's corner.
When passing a POINT
to functions that expect screen coordinates, the coordinates are expressed in pixels relative to the upper‑left corner of the screen. For client‑area coordinates, they are relative to the upper‑left corner of the window's client area.
Example
#include <windows.h>
#include <stdio.h>
int main() {
POINT pt;
if (GetCursorPos(&pt)) {
printf("Cursor position: (%ld, %ld)\n", pt.x, pt.y);
}
return 0;
}