Get current cursor type
-
Hi together, is it somehow possible to get the current type of the mouse cursor? I'd like to check whether the current cursor is the context help cursor (IDC_HELP) or not. However, I have no idea how to accomplish that :( Thank you very much for your help, Marcus.
-
Hi together, is it somehow possible to get the current type of the mouse cursor? I'd like to check whether the current cursor is the context help cursor (IDC_HELP) or not. However, I have no idea how to accomplish that :( Thank you very much for your help, Marcus.
GetCursor()
orGetCursorInfo()
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
-
GetCursor()
orGetCursorInfo()
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
Hi Ryan, thank you very much for your hint. I got it working! However, for me it wasn't that straightforward to get it run. If anybody is interested in the solution, here it is:
// Load a cursor of the type that should be checked.
// The clue: The handle to the cursor is unique, so we can use it for comparison.
HCURSOR hHelpCursor = LoadCursor(NULL, IDC_HELP);// Use GetCursorInfo() to get information about the current (global) cursor.
CURSORINFO ci;
ci.cbSize = sizeof(ci);
if(GetCursorInfo(&ci))
{
if(ci.hCursor == hHelpCursor)
cout << "Context help cursor active!" << endl;
}Any hints for improvement are welcome! Thanks again, Marcus.
-
Hi Ryan, thank you very much for your hint. I got it working! However, for me it wasn't that straightforward to get it run. If anybody is interested in the solution, here it is:
// Load a cursor of the type that should be checked.
// The clue: The handle to the cursor is unique, so we can use it for comparison.
HCURSOR hHelpCursor = LoadCursor(NULL, IDC_HELP);// Use GetCursorInfo() to get information about the current (global) cursor.
CURSORINFO ci;
ci.cbSize = sizeof(ci);
if(GetCursorInfo(&ci))
{
if(ci.hCursor == hHelpCursor)
cout << "Context help cursor active!" << endl;
}Any hints for improvement are welcome! Thanks again, Marcus.
khb wrote:
Any hints for improvement are welcome!
It's exactly what I'd do :)
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
-
khb wrote:
Any hints for improvement are welcome!
It's exactly what I'd do :)
Ryan
"Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"