源代码如下:
#include "stdafx.h"
#include <windows.h>
#include <winable.h>int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{ INPUT mosinput[2];
mosinput[1].type = INPUT_MOUSE;
mosinput[1].mi.dx = 0;
mosinput[1].mi.dy = 300;
mosinput[1].mi.mouseData = MOUSEEVENTF_RIGHTDOWN;
mosinput[2].type = INPUT_MOUSE;
mosinput[2].mi.dx = 0;
mosinput[2].mi.dy = 300;
mosinput[2].mi.mouseData = MOUSEEVENTF_LEFTDOWN; int i = 0;
i = SendInput( 2, mosinput, sizeof(INPUT) );
if( i = 0 )
MessageBox( 0, "失败!", NULL, 0 );
return 0;
}
#include "stdafx.h"
#include <windows.h>
#include <winable.h>int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{ INPUT mosinput[2];
mosinput[1].type = INPUT_MOUSE;
mosinput[1].mi.dx = 0;
mosinput[1].mi.dy = 300;
mosinput[1].mi.mouseData = MOUSEEVENTF_RIGHTDOWN;
mosinput[2].type = INPUT_MOUSE;
mosinput[2].mi.dx = 0;
mosinput[2].mi.dy = 300;
mosinput[2].mi.mouseData = MOUSEEVENTF_LEFTDOWN; int i = 0;
i = SendInput( 2, mosinput, sizeof(INPUT) );
if( i = 0 )
MessageBox( 0, "失败!", NULL, 0 );
return 0;
}
MessageBox( 0, "失败!", NULL, 0 ); if( i == 0 )
MessageBox( 0, "失败!", NULL, 0 );
这也有点问题吧,是不是2 * sizeof(INPUT)??