Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //
- // ctrlv.c - Simulates pressing Ctrl-V once a second
- //
- // Written by Ted Burke - last updated 18-10-2012
- //
- // To compile with MinGW:
- //
- // gcc -o ctrlv.exe ctrlv.c
- //
- // To run the program:
- //
- // ctrlv.exe
- //
- // Because the SendInput function is only supported in
- // Windows 2000 and later, WINVER needs to be set as
- // follows so that SendInput gets defined when windows.h
- // is included below.
- #define WINVER 0x0500
- #include <windows.h>
- int main()
- {
- char kata[] = "Percobaan menekan tombol";
- // Create a generic keyboard event structure
- INPUT ip;
- ip.type = INPUT_KEYBOARD;
- ip.ki.wScan = 0;
- ip.ki.time = 0;
- ip.ki.dwExtraInfo = 0;
- sleep(2000);
- int i;
- for(i=0; i<=strlen(kata); i++){
- // tekan hurufnya
- printf("%c ",kata[i]);
- ip.ki.wVk = kata[i];
- ip.ki.dwFlags = 0; // tekan tombol
- SendInput(1, &ip, sizeof(INPUT));
- ip.ki.wVk = kata[i];
- ip.ki.dwFlags = KEYEVENTF_KEYUP; // lepas tombol
- SendInput(1, &ip, sizeof(INPUT));
- sleep(1000);
- }
- Sleep(1000);
- getch();
- return 0;
- }
Add Comment
Please, Sign In to add comment