Mouseclick outside from widget
Hello,
i want set and click the cursor outside from my Application (e.k. a game in windowsmode or a word dokument).
I have tested
to set my Mouseposition. Its work, the mousposition are outside on my widget and application(my application is only 1 px big).
but the click doesnt work :(
I have use/testing
Code:
#include <Windows.h>
...
mouse_event(MOUSEEVENTF_LEFTDOWN,0, 0, 0,0);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0,0);
or
Code:
#include <QtTest/QTest>
...
eventList->addDelay(2000);
eventList
->addMouseMove
(QPoint(15,
35));
eventList
->addMouseClick
(Qt
::LeftButton,Qt
::NoModifier,
QPoint(15,
35));
eventList->simulate(this);
but nothing work :(
Idont know what i can do.... can someone help me please ?
Re: Mouseclick outside from widget
AFAIK there's no way Qt simulate window manager events (like mouse click) outside your own app.
You need to ask window manager to do it for you (calling SendInput on Windows or XSendEvent on X11.
Re: Mouseclick outside from widget
I have think that
Code:
mouse_event(MOUSEEVENTF_LEFTDOWN,0, 0, 0,0);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0,0);
is to say the Windows API what they must do maybe outside my application
Re: Mouseclick outside from widget
Yeah, I missed it.
So, maybe you should try adding MOUSEEVENTF_ABSOLUTE flag?