a resize-window problem

hi… i have simple program that creates
a rectangle. But you can drag & drop it
by using the mouse. But when u resize the window it does not work. Now i have 2 questions.
1- is there a way (or a function) to understand that the mouse pointer is on the
rectangle except using the coordinates of both (i compared coordinates of mouse and rectangle)??
2-how can i overcome the resize problem?

I’m not sure I completely understand your problem, but are you properly setting the viewport and projection matrix on a window resize?