开发者

Hide Cursor in Client Rectangle but not on Title Bar

开发者 https://www.devze.com 2023-02-23 14:47 出处:网络
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开发者_运

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;
0

精彩评论

暂无评论...
验证码 换一张
取 消