Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. It's possible to recognise hidden mouse cursor by game?
Forum Updated to NodeBB v4.3 + New Features

It's possible to recognise hidden mouse cursor by game?

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 406 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BD9a
    wrote on last edited by
    #1

    Hello, how can I recognise hidden cursor by game (minecraft)? In other games (no java games, ex. Arma3) I can use "GetCursorInfo Flags", but in this case it dont work (always print "visible").

    #include <iostream>
    #include <windows.h>
    
    int main()
    {
        while (true)
        {
            CURSORINFO ci = {sizeof(CURSORINFO)};
    
            if (GetCursorInfo(&ci))
            {
                if (ci.flags == 0)
                    std::cout << "hidden\n"; // cursor is hidden
                else if (ci.flags == 1)
                    std::cout << "visible\n"; // cursor is visible
                else if (ci.flags == 2)
                    std::cout << "suppressed\n"; // cursor is suppressed
                else
                    std::cout << "ERROR\n"; // this shouldn't happen!
            }
            else
            {
                std::cout << "Win32 error: " << GetLastError() << std::endl; // GetCursorInfo function failed
            }
        }
    }
    

    It's possible to "fix" it using Qt?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      If the game is using a custom cursor, im not sure you can use GetCursorInfo on it.

      1 Reply Last reply
      0
      • B Offline
        B Offline
        BD9a
        wrote on last edited by
        #3

        What do you mean in "custom cursor"? It probably works like in other games, hide cursor to move camera, and show cursor when open inventory or open menu. I need to recognise when inventory open by cursor visibility. I tried with those code above, but it dont work in Minecraft (in for example Arma3 works good).

        mrjjM 1 Reply Last reply
        0
        • B BD9a

          What do you mean in "custom cursor"? It probably works like in other games, hide cursor to move camera, and show cursor when open inventory or open menu. I need to recognise when inventory open by cursor visibility. I tried with those code above, but it dont work in Minecraft (in for example Arma3 works good).

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @BD9a
          Hi
          A custom cursor is one where they do not use the system API for it.
          Like draw it as a sprite or other methods.
          In that case the API wont return useful info.

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved