Hide Cursor in Client Rectangle but not on Title Bar
I am trying to hide the cursor in the client area of my window (DirectX application) but would like the default behavior in the title bar. I've tried several things but I didn't find any way开发者_运维技巧 to do this. Does anyone have an idea how to achieve this?
Add something like this to your wndproc:
case WM_SETCURSOR:
{
WORD ht = LOWORD(lparam);
static bool hiddencursor = false;
if (HTCLIENT==ht && !hiddencursor)
{
hiddencursor = true;
ShowCursor(false);
}
else if (HTCLIENT!=ht && hiddencursor)
{
hiddencursor = false;
ShowCursor(true);
}
}
break;
精彩评论