Advertisement
Agus_Darmawan

project_shutdown

Nov 20th, 2019
286
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.06 KB | None | 0 0
  1. #define WINVER 0x0500
  2. #include <windows.h>
  3.  
  4. //inisialisasi keyboard
  5. INPUT ip;
  6.  
  7. void tekanCharacter(char c){
  8.     ip.ki.wVk = VkKeyScan(c);
  9.     ip.ki.dwFlags = 0; // tekan tombol
  10.     SendInput(1, &ip, sizeof(INPUT));
  11.     Sleep(300);
  12.  
  13.     ip.ki.wVk = VkKeyScan(c);
  14.     ip.ki.dwFlags = KEYEVENTF_KEYUP; // lepas tombol
  15.     SendInput(1, &ip, sizeof(INPUT));
  16. }
  17.  
  18. // tekan ALT
  19. void tekanTAB(int ch){
  20.     ip.ki.wVk = ch;
  21.     ip.ki.dwFlags = 0;
  22.     SendInput(1, &ip, sizeof(INPUT));
  23. }
  24.  
  25. // lepas ALT
  26. void lepasTAB(int ch){
  27.     ip.ki.wVk = ch;
  28.     ip.ki.dwFlags = KEYEVENTF_KEYUP;
  29.     SendInput(1, &ip, sizeof(INPUT));
  30. }
  31.  
  32. int main() {
  33.  
  34.     char nama[] = {'A','G','U','S',' ','D','A','R','M','A','W','A','N'};
  35.     ip.type = INPUT_KEYBOARD;
  36.     ip.ki.wScan = 0;
  37.     ip.ki.time = 0;
  38.     ip.ki.dwExtraInfo = 0;
  39.  
  40.     /*
  41.      * DIA AKAN MENEKAN DI BAWAH SINI
  42.      =>
  43.      */
  44.     int i = 0;
  45.     while(nama[i] != '\0') {
  46.         tekanCharacter(nama[i]);
  47.         i++;
  48.     }
  49.  
  50.     Sleep(1000);
  51.     tekanTAB(VK_TAB);
  52.     lepasTAB(VK_TAB);
  53.     return 0;
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement