G
G
German2019-04-14 00:21:12
C++ / C#
German, 2019-04-14 00:21:12

SetCoursorPos not working in full screen apps?

The program works with the SetCursorPos() and GetCursorPos() methods , everything is fine, but they do not work in applications that capture the cursor, such as games.
I will give an example on the game - using SetCursorPos() you can work with the application if the cursor is not hidden (switch items in the menu, etc.), and as soon as the game hides the cursor, the functions stop working, what should I do?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
Nikita, 2019-04-14
@NS33

For example, in the case of DirectX, it uses its own cursor:
SetCursor( NULL );//remove the Windows cursor
m_pd3dDevice->ShowCursor( TRUE );//IDirect3DDevice9::ShowCursor

E
Ezhyg, 2019-04-14
@Ezhyg

So there really is no cursor, how can you work with something that is not there ?!
All right, all right - work with the mouse (and keyboard, if necessary), as other "game programs" do.

W
Warlodya, 2019-04-14
@Warlodya

As an option

spoiler
INPUT  Input = { 0 };
    Input.type = INPUT_MOUSE;
    Input.mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE;
    Input.mi.dx = fx;
    Input.mi.dy = fy;
    SendInput(1, &Input, sizeof(INPUT));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question