Are you calling AdjustWindowRect() before CreateWindow() (or SetWindowPos()) to let the OS bloat the window bounds to account for the frame, border, and caption pixels?:


RECT rect;
rect.left ...