Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9119181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T05:20:02+00:00 2026-06-17T05:20:02+00:00

I need help with making a certain MFC program. I need to make a

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T05:20:04+00:00Added an answer on June 17, 2026 at 5:20 am

    If you want to get two results from a same event, you have to keep a state variable to track wht click is it.

    On other words, your CsemDoc should have an a_pos and b_pos members, and CsemView a bool is_b, initialized as false.

    The OnLButtonDow method should: be something like

    if(!is_b)
    { set the a_pos; is_b = true; }
    else
    { set the b_pos; is_b = false; invalidate the draw; }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need help making an algorithm to detect that all the conditions for HAVE_ENOUGH_DATA
I am making an application that will allow users to apply certain tools to
So I have made this program for a game and need help with making
I need help on making a delete confirmation that need a minimum of 1
I need help making AOP work. What am I missing here? <?xml version=1.0 encoding=UTF-8?>
I need help with making an image float onto the canvas in HTML5 and
Need help with a query that I wrote: I have three tables Company id
need help regarding USSD Gateway. I have to develop an app, which will directly
I need help with making this bit of code faster: UnitBase* Formation::operator[](ushort offset) {
I need help making this code work better. Currently, what happens is when it

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.