introduction to QT, entry to windows development.
I want to use QT to achieve a function of simulating mouse clicks (Windows platform). Specifically, it goes like this: first get the handle of a specific name window, and then simulate clicking on a specific location of the window, and require that the window can not be displayed at the front of the desktop (that is, a virtual click, rather than moving the mouse pointer to that position and then clicking)
according to the content on the Internet, I wrote a simple SLOT function as follows:
void MainWindow::clickTest()
{
HWND hwndGameWindow=::FindWindow(NULL,L"");
gameWindow=QWidget::find((WId)hwndGameWindow);
qDebug()<<(QString)(gameWindow->windowTitle());
QPoint *pos=new QPoint(112,83);
QMouseEvent *clickEvent=new QMouseEvent(QEvent::MouseButtonPress,*pos,Qt::LeftButton,Qt::LeftButton,Qt::NoModifier);
QApplication::sendEvent(gameWindow,clickEvent);
}
when I triggered this slot function, the system reported a segment error and the program forced to exit.
I would like to ask you what the mistake is? I would appreciate it if you could give me another way to achieve the functions I have described.