Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 467
Millianz Avatar asked Apr 12 '11 02:04

Millianz


1 Answers

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;
like image 135
Anders Avatar answered Oct 17 '22 06:10

Anders