CRect rect = CRect(0, 0, 100, 100); // create a rectangle with top-left corner at (0,0) and bottom-right corner at (100,100)
POINT point = { 50, 50 }; // create a point at (50,50) if (PtInRect(&rect, point)) { // check if the point is inside the rectangle // the point is inside the rectangle }In the above example, the code checks whether the point at (50,50) lies inside the rectangle created by CRect. The PtInRect function returns a boolean value indicating whether the point is inside the rectangle or not. CRect and PtInRect are part of the MFC (Microsoft Foundation Classes) library in C++. They are used in Windows programming for GUI (Graphical User Interface) applications.