Advertisement
Koelion

Untitled

Nov 9th, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. #include <windows.h>
  2. #include <cstring>
  3. #include <iostream>
  4. #include <cstdlib>
  5. using namespace std;
  6.  
  7. void toClipboard(const std::string &s){
  8. HWND hwnd = GetDesktopWindow();
  9. OpenClipboard(hwnd);
  10. EmptyClipboard();
  11. HGLOBAL hg=GlobalAlloc(GMEM_MOVEABLE,s.size()+1);
  12. if (!hg){
  13. CloseClipboard();
  14. return;
  15. }
  16. memcpy(GlobalLock(hg),s.c_str(),s.size()+1);
  17. GlobalUnlock(hg);
  18. SetClipboardData(CF_TEXT,hg);
  19. CloseClipboard();
  20. GlobalFree(hg);
  21. }
  22.  
  23. int main()
  24. {
  25. bool Spam = false;
  26.  
  27. string Tekst;
  28. cout << "Podaj tekst:";
  29. getline(cin, Tekst);
  30. toClipboard(Tekst);
  31.  
  32. int Speed = 1;
  33. cout << "Podaj Predkosc w MS:";
  34. cin >> Speed;
  35.  
  36. cout << "START/STOP F9" << endl;
  37.  
  38. while(0==0)
  39. {
  40. if(GetAsyncKeyState(VK_F9))
  41. {
  42. Spam = !Spam;
  43. Sleep(200);
  44. }
  45. if(Spam)
  46. {
  47.  
  48. keybd_event(VK_CONTROL,0,0 , 0); // Press
  49. Sleep(1);
  50. keybd_event((int)'V',0,0 , 0); // Press
  51. Sleep(1);
  52. keybd_event((int)'V',0,KEYEVENTF_KEYUP,0); // Release
  53. Sleep(1);
  54. keybd_event(VK_CONTROL,0,KEYEVENTF_KEYUP,0); // Release
  55. Sleep(1);
  56.  
  57. keybd_event(VK_RETURN,0,0 , 0); //Alt Press
  58. Sleep(1);
  59. keybd_event(VK_RETURN,0,KEYEVENTF_KEYUP,0); // Alt Release
  60. Sleep(1);
  61. }
  62. Sleep(Speed);
  63. }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement