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

  • Home
  • SEARCH
  • 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 5934823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:10:04+00:00 2026-05-22T15:10:04+00:00

I dont understand why this doesn’t work. On message WM_LBUTTONDOWN, the coordinates of the

  • 0

I dont understand why this doesn’t work. On message WM_LBUTTONDOWN, the coordinates of the pointer are stored. then on WM_MOUSEMOVE, if the left button is down, i want it to draw an ellipse with the original points and the new points that are where the mouse is now. But nothing happens when I debug. Here is my WindowProc

LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
PAINTSTRUCT ps;
HDC hdc;


switch (uMsg)
{

    case WM_DESTROY: 
    {
    DestroyWindow(hwnd);
    PostQuitMessage(0);
    break;

    }
    case WM_PAINT:
    {
        hdc = BeginPaint(hwnd, &ps);
        EndPaint(hwnd, &ps);
        break;
    }
    case WM_LBUTTONDOWN:
    {
        pnt.x = GET_X_LPARAM(lParam);
        pnt.y = GET_Y_LPARAM(lParam);
        break;
    }
    case WM_MOUSEMOVE:
    {
        if(wParam == MK_LBUTTON)
        {
            hdc = BeginPaint(hwnd, &ps);
            Ellipse(hdc, pnt.x, pnt.y, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)); // nothing happens
            EndPaint(hwnd, &ps);
        }
        break;
    }
    return 0;
}
   return  DefWindowProc(hwnd, uMsg, wParam, lParam);
 }
  • 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-05-22T15:10:05+00:00Added an answer on May 22, 2026 at 3:10 pm

    Try code something like this:

    static POINT begin, end;
    static BOOL drawing = false;
    
    // ...
    
    
    case WM_PAINT:
        hdc = BeginPaint(hWnd, &ps);
        if (drawing)
            Ellipse(hdc, begin.x, begin.y, end.x, end.y);
        EndPaint(hWnd, &ps);
        break;
    
    case WM_LBUTTONDOWN:
        begin.x = GET_X_LPARAM(lParam);
        begin.y = GET_Y_LPARAM(lParam);
        SetCapture(hWnd);
        drawing = true;
        break;
    
    case WM_LBUTTONUP:
        ReleaseCapture();
        drawing = false;
        break;
    
    case WM_MOUSEMOVE:
        end.x = GET_X_LPARAM(lParam);
        end.y = GET_Y_LPARAM(lParam);
        { 
            RECT invalid = {begin.x, begin.y, end.x, end.y};
            InvalidateRect(hWnd, &invalid, true);
        }
        break;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I don't understand why this doesn't work: [abc = ([def intValue] - 71) *
I don't understand why this doesn't work. Explanation will be appreciated. var scrollTop =
Hi I don't understand why this code doesn't work - it don't remove key;
I don't understand why this doesn't work. I have a div with an iframe
I don't understand why this doesn't work. I am using a file to set
SELECT * FROM mytable WHERE match(fieldname) against('spa') I don't understand why this query doesn't
I'm using this simple node.js code example but I don't understand why FireBug doesn't
I don't undestand why this script doesn't work in IE, while it works in
Im using Doctrine and i dont quite understand this code here: $this->hasColumn('id', 'integer', 8,
I dont really understand why this is not working, I am being returned to

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.