Changing mouse corsors
I want to make two functions
1. to change mouse pointer to another
I've done this and this is working perfectly
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
void changecursor()
{
// load a copy of the cross cursor
HCURSOR hcCross = LoadCursor(0, IDC_CROSS);
assert(hcCross);
HCURSOR hcCrossCopy = CopyCursor(hcCross);
assert(hcCrossCopy);
// make the system arrow cursor the cross cursor
// NOTE: IDC_ARROW == MAKEINTRESOURCE(OCR_NORMAL)
// cout << "Changing normal cursor to cross cursor" << endl;
BOOL ret = SetSystemCursor(hcCrossCopy, 32512);
assert(ret);
DestroyCursor(hcCross);
}
|
I want to make another function which restores the original cursor
I've done this but this is not working
1 2 3 4 5 6 7 8 9 10 11 12
|
void restorecursor()
{
// load a copy of the arrow cursor (so we can restore it)
HCURSOR hcArrow = LoadCursor(0, IDC_ARROW);
assert(hcArrow);
HCURSOR hcArrowCopy = CopyCursor(hcArrow);
assert(hcArrowCopy);
// restore the arrow cursor
BOOL ret = SetSystemCursor(hcArrowCopy, 32512);
assert(ret);
DestroyCursor(hcArrow);
}
|
Please check the restorecursor() function if I've done something wrong.
Please correct me.
Thank You
Last edited on
Topic archived. No new replies allowed.