#include<stdio.h>
#include<stdlib.h>
#include<Windows.h>
void openbaidu()
{
ShellExecuteA(0, "open", "www.baidu.com", 0, 0, 1);
}
void closebaidu()
{
system("taskkill /f /im Firefox.exe");
}
void clickbaidu()
{
SetCursorPos(100,40);//确定鼠标光标的位置
Sleep(1000);
mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0,0);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);
/*mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);*/
}
void main()
{
openbaidu();
Sleep(5000);
clickbaidu();
closebaidu();
Sleep(1000);
}