Public feed
#890480
#include <Windows.h>
#include <math.h>
#include <time.h>
int main( char **args[], int arg )
{
while( !GetAsyncKeyState(VK_ESCAPE) )
{
int i = 0;
//sleep so we dont eat up cpu power
Sleep(1);
//move the mouse by dx and dy
x += dx;
y += dy;
//check to see if the mouse goes off the screen
if( ( x >= 65535 ) ){ dx *= -1; Beep( rand() % 1000 + 1, rand() % 500 + 1 ); }
if( ( y >= 65535 ) ){ dy *= -1; Beep( rand() % 1000 + 1, rand() % 500 + 1 ); }
if( ( x <= 0 ) ){ dx *= -1; Beep( rand() % 1000 + 1, rand() % 500 + 1 ); }
if( ( y <= 0 ) ){ dy *= -1; Beep( rand() % 1000 + 1, rand() % 500
+ 1 ); }
//move mouse
mouse_event( MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE, x , y , MOUSEEVENTF_ABSOLUTE, GetMessageExtraInfo());
//make the movement more random
if ( ( rand() % 3 - 1 ) == 1 )
dx += rand() % 60;
if ( ( rand() % 3 - 1 ) == -1 )
dx -= rand() % 60;
if ( ( rand() % 3 - 1 ) == 0 )
dx -= 0;
if ( ( rand() % 3 - 1 ) == 1 )
dy += rand() % 60;
if ( ( rand() % 3 - 1 ) == -1 )
dy -= rand() % 60;
if ( ( rand() % 3 - 1 ) == 0 )
dy -= 0;
//loop through the windows
i++;
if ( i > 20 ) i = 0;
}
return 1;
}