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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
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
You may also declare ownerdraw button behind your image, there is no need to obtain the location of the cursor then.