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 1005181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T08:15:14+00:00 2026-05-16T08:15:14+00:00

Ok so I’m working with vectors today yaya! well im also working with getcursorpos()

  • 0

Ok so I’m working with vectors today yaya!
well im also working with getcursorpos() and i get weird results.
here is the code:

VOID fRegularShot(HDC hdc, HWND hWnd)
{
    Graphics graphics(hdc);
    Image shot(L"RegularShots.png");
    long index=0;
    while(index<=(long)pRegularShots.size())
    {
        index+=2;
        int x=pRegularShots.at(index);
        int y1=index+1;
        int y=pRegularShots.at(y1);
        graphics.DrawImage(&shot, x, y);
    }
}
///////////////////////////////////////////////////
event
case WM_LBUTTONDOWN:
    iRegularShots=0;
    POINT pt;
    GetCursorPos(&pt);
    pRegularShots.insert(pRegularShots.begin()+1, pt.y);
    pRegularShots.insert(pRegularShots.begin()+1, pt.x);
    InvalidateRect(hWnd, rect, false);
    break;

Well basically function fregularshots() get called and use the vector elements which contains the positions of the cursor than draws the image on the cursor positions.
but it doesn’t seem to draw it on the cursor positions.
any ideas?

  • 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-16T08:15:15+00:00Added an answer on May 16, 2026 at 8:15 am

    GetCursorPos returns cursor position in screen coordinates. Use ScreenToClient(hWnd, …) to convert it to window client coordinates.

    GetCursorPos(&pt);
    ScreenToClient(hWnd, &pt);
    

    You can work also without GetCursorPos function. When WM_LBUTTONDOWN notification is received, lParam contains window client mouse coordinates: x in low-order word, y in high-order word:

    xPos = GET_X_LPARAM(lParam); 
    yPos = GET_Y_LPARAM(lParam); 
    

    Edit:
    Let’s make this code more simple.

    vector<POINT> pRegularShots;
    
    VOID fRegularShot(HDC hdc, HWND hWnd) 
    { 
        Graphics graphics(hdc); 
        Image shot(L"RegularShots.png"); 
        long index=0; 
        while(index < (long)pRegularShots.size()) 
        { 
            graphics.DrawImage(&shot, pRegularShots[index].x, pRegularShots[index].y); 
            ++index;
        } 
    } 
    
    
    case WM_LBUTTONDOWN: 
        POINT pt; 
        pt.x = GET_X_LPARAM(lParam); 
        pt.y = GET_Y_LPARAM(lParam); 
        pRegularShots.push_back(pt); 
        InvalidateRect(hWnd, rect, false); 
        break; 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I've tracked down a weird MySQL problem to the two different ways I was
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

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.