Capturing Mouse pointer shape change event in MFC

2019-07-29 10:32发布

I am writing a windows application which requires mouse pointer shape change notification. I have searched thoroughly but could not find a satisfactory solution. I want to receive a notification for cursor shape change as well as the type of cursor to which it has changed.

From the search I came to know that I will have to install a hook in every process and capture WM_SETCURSOR event but capturing this message does not give me full information. So please guide me if anybody can help

1条回答
欢心
2楼-- · 2019-07-29 11:32

You can get the handle to the current cursor with GetCursor or GetCursorInfo.

The problem is to know which cursor the handle refers to. I don't think there's a "reverse find" function, so you would have to implement it by comparing your handle with the one returned by LoadCursor for the different possible values.

Fortunately, the docs say this:

The LoadCursor function loads the cursor resource only if it has not been loaded; otherwise, it retrieves the handle to the existing resource.

查看更多
登录 后发表回答