Advertisement
Agus_Darmawan

fungsiTekanLepas

Jul 4th, 2019
251
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.10 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #define WINVER 0x0500
  4. #include <windows.h>
  5.  
  6.  
  7. int main(int argc, char *argv[]){
  8.   //inisialisasi keyboard
  9.   INPUT ip;
  10.  
  11.   ip.type = INPUT_KEYBOARD;
  12.   ip.ki.wScan = 0;
  13.   ip.ki.time = 0;
  14.   ip.ki.dwExtraInfo = 0;
  15.  
  16.   tekanCTRL();
  17.   tekanESC();
  18.   lepasCTRL();
  19.   lepasESC();
  20.  
  21.   tekanTAB();
  22.   lepasTAB();
  23.  
  24.   getch();
  25.   return 0;
  26. }
  27.  
  28. //tekan ctrl
  29. void tekanCTRL(){
  30.   ip.ki.wVk = VK_CONTROL;
  31.   ip.ki.dwFlags = 0;
  32.   SendInput(1, &ip, sizeof(INPUT));
  33. }
  34.  
  35. //lepas ctrl
  36. void lepasCTRL(){
  37.   ip.ki.wVk = VK_CONTROL;
  38.   ip.ki.dwFlags = KEYEVENTF_KEYUP;
  39.   SendInput(1, &ip, sizeof(INPUT));
  40. }
  41.  
  42. //tekan escape
  43. void tekanESC(){
  44.   ip.ki.wVk = VK_ESCAPE;
  45.   ip.ki.dwFlags = 0;
  46.   SendInput(1, &ip, sizeof(INPUT));
  47. }
  48.  
  49. //lepas escape
  50. void lepasESC(){
  51.   ip.ki.wVk = VK_ESCAPE;
  52.   ip.ki.dwFlags = KEYEVENTF_KEYUP;
  53.   SendInput(1, &ip, sizeof(INPUT));
  54. }
  55.  
  56. void tekanTAB(){
  57.   ip.ik.wVk = VK_TAB
  58.   ip.ik.dwFlags = 0;
  59.   SendInput = (1, &i, INPUT);
  60. }
  61.  
  62. void lepasTAB(){
  63.   ip.ik.wVk = VK_TAB;
  64.   ip.ik.dwFlags = KEYEVENTF_KEYUP;
  65.   SendInput(1, &i, INPUT);
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement