Advertisement
Koelion

HOTKEY

Nov 18th, 2013
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3.  
  4. using namespace std;
  5.  
  6. bool Wlaczone = false;
  7.  
  8. int Hotkey1[2];
  9.  
  10. int main()
  11. {
  12. Hotkey1[0] = VK_NUMPAD0;
  13. Hotkey1[1] = 0x5A;
  14.  
  15. cout << "OFF" << endl;
  16.  
  17. while(true)
  18. {
  19. if(GetAsyncKeyState(VK_F1))
  20. {
  21. system("CLS");
  22. Wlaczone =! Wlaczone;
  23. if(Wlaczone)
  24. cout << "ON" << endl;
  25. else
  26. cout << "OFF" << endl;
  27. Sleep(200);
  28. }
  29. if(Wlaczone)
  30. {
  31. if(GetAsyncKeyState(Hotkey1[0]))
  32. {
  33. for(int i=0; i<6; i++)
  34. {
  35. keybd_event(Hotkey1[1], 0, 0, 0);
  36. keybd_event(Hotkey1[1], 0, KEYEVENTF_KEYUP, 0);
  37. Sleep(100);
  38. }
  39. }
  40. }
  41. }
  42.  
  43. return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement