I need help with making a certain MFC program. I need to make a program that will draw a line in the following way: the user chooses the starting point by left clicking, and the final point by left clicking the second time, after which the points are connected and the line is drawn. I've managed to get the coordinates of the first one with this:
void CsemView::OnLButtonDown(UINT nFlags, CPoint point)
{
CsemDoc* pDoc= GetDocument();
// TODO: Add your message handler code here and/or call default
pDoc->a_pos=point;
Invalidate();
CView::OnLButtonDown(nFlags, point);
}
The problem is, i don't know how to get the coordinates of the second one with the second left click. I've managed to do it by using the on double left click function( and putting pDoc->b_pos=point; in it), but that's not really what I was supposed to do. (I was putting in the coordinates of the first one into MoveTo and the second one into LineTo). I would appreciate if someone could help me (I'm suspecting there's perhaps a different, simpler way of doing this). Thanks in advance.