Menu

?'s about cursors

2002-08-24
2012-09-26
  • Nobody/Anonymous

    I am a beginner.  I hate to ask for code but I can't find anything about cursors in my book.  I want to make a popup menu when the user right-clicks on the image, which is basicly the whole window.  I know I can use case WM_RBUTTONDOWN to handle the right-click, but that's about it.  If you could tell me how to get the location of the cursor, I think I can figure the rest out on my own.

     
    • Nobody/Anonymous

      Hey man,

      The GetCursorPos function retrieves the cursors position, in screen coordinates.

      BOOL GetCursorPos(

          LPPOINT lpPoint     // address of structure for cursor position 
         );   
      Parameters

      lpPoint:
      Points to a POINT structure that receives the screen coordinates of the cursor.

      Return Values:
      If the function succeeds, the return value is nonzero.
      If the function fails, the return value is zero. To get extended error information, call GetLastError.

      Remarks:
      The cursor position is always given in screen coordinates and is not affected by the mapping mode of the window that contains the cursor.
      The calling process must have WINSTA_READATTRIBUTES access to the window station.

      Hope that helps. =)

      Kip

       
    • Nobody/Anonymous

      You may also declare ownerdraw button behind your image, there is no need to obtain the location of the cursor then.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.