給妳壹部分。
頭文件:
#include <Windows.h>
#include <Winuser.h>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <string.h>
#include <time.h>
時間等待函數:
void wait ( int m_seconds )
{ clock_t endwait;
endwait = clock () + m_seconds ;
while (clock() < endwait) {}
}
調用參數單位是毫秒。
毫秒數用隨機數:
double r;
srand((unsigned)time(NULL)); // 種子
r = ( (double)rand() / ((double)(RAND_MAX)+(double)(1)) );
r = r * 2000.0; // 0-2000 毫秒
按鍵:
例如按cmd和回車
keybd_event(VkKeyScan('C'),1,0,0); keybd_event(VkKeyScan('C'),1,KEYEVENTF_KEYUP,0);
keybd_event(VkKeyScan('M'),1,0,0); keybd_event(VkKeyScan('M'),1,KEYEVENTF_KEYUP,0);
keybd_event(VkKeyScan('D'),1,0,0); keybd_event(VkKeyScan('D'),1,KEYEVENTF_KEYUP,0);
keybd_event(VK_RETURN,1,0,0);
keybd_event(VK_RETURN,1,KEYEVENTF_KEYUP,0);
------
運氣好妳看到上面的語句。