What you wrote is wrong. The Windows API uses a nasty convention of naming and naming types. LPRECT means "Long Pointer to Rect", which in your usual architecture is just RECT* . What you wrote is some uninitialized pointer variable pointing to some arbitrary location (if you are unlucky that changing your program will crash).
This is what you really need:
RECT rect; GetWindowRect(hwnd, &rect);
RECT itself is a structure
typedef struct _RECT { LONG left; LONG top; LONG right; LONG bottom; } RECT;
source share