简体   繁体   中英

Cursor flashing on the non-client area when using IDirect3DDevice9::SetCursorProperties

I have an application running under Direct3D9. The application is using the Direct3D HW cursor API ( IDirect3DDevice9::SetCursorProperties et al.) to control the cursor. Almost everything works fine:

  • when inside of the application window, the cursor specified by SetCursorProperties is shown
  • when outside of the application window, normal OS cursor is displayed as needed by desktop or other windows

The problem is with the non-client area of my window (the title bar, screen edges). When moving in the non-client area, the cursor corresponding to the function of the area is breifly shown, but once I stop moving, the cursor set in SetCursorProperties is shown again.

What is the correct way to use IDirect3DDevice9::SetCursorProperties so that I get the default OS cursors on my window non-client area?

After experimenting with various things, a following change in the application has solved the issue for me:

  • In a window procedure, when a WM_SETCURSOR is received, remember a result of a condition (lParam&0xffff)==HTCLIENT in a global variable CursorInClient
  • When the global variable CursorInClient is false, avoid calling IDirect3DDevice9::ShowCursor

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM