Advertisement
Guest User

Untitled

a guest
Nov 1st, 2013
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. #include <iostream>
  2. #include <stdio.h>
  3. #include <Windows.h>
  4. #include "winuser.h"
  5. #include "tchar.h"
  6. #include <string>
  7. #include <time.h>
  8. using namespace std;
  9. bool spamBot(string text, int intervels, int numOfTimes);
  10. void sleep( time_t delay );
  11. void restart();
  12. string willRestart;
  13. string text;
  14. int intervels;
  15. int numOfTimes;
  16. string start;
  17. int main()
  18. {
  19. std::string text;
  20. std::cout << "Insert Desired Text: " << endl;
  21. getline(cin, text);
  22. std::cout << "Set Intervel: " << endl;
  23. std::cin >> intervels;
  24. std::cout << "Set Number of Times: " << endl;
  25. std::cin >> numOfTimes;
  26. std::cout << "Would you like to start? y/n: ";
  27. std::cin >> start;
  28. if (start == "y")
  29. {
  30. cout << "5" << endl;
  31. Sleep(1000);
  32. cout << "4" << endl;
  33. Sleep(1000);
  34. cout << "3" << endl;
  35. Sleep(1000);
  36. cout << "2" << endl;
  37. Sleep(1000);
  38. cout << "1" << endl;
  39. Sleep(1000);
  40. spamBot(text, intervels, numOfTimes);
  41. }
  42. if (start == "n")
  43. {
  44. return 0;
  45. }
  46. cout << "Would you like to restart? y/n: ";
  47. cin >> willRestart;
  48. if(willRestart == "y")
  49. {
  50. restart();
  51. }
  52. }
  53. bool spamBot(string text, int x, int y)
  54. {
  55. HWND spamWindow = GetForegroundWindow(); //problem starts here, only keystrokes notepad help!
  56. if(spamWindow == NULL)
  57. return FALSE;
  58. //Handle of notepad control
  59. HWND edit = FindWindowEx( spamWindow, NULL, _T( "Edit" ), NULL );
  60. if(edit == NULL)
  61. return FALSE;
  62. for(int z=0;z<y;z++)
  63. {
  64. SendMessage(edit, EM_REPLACESEL, (WPARAM)TRUE, (LPARAM)text.c_str());
  65. Sleep(5);
  66. keybd_event(VK_RETURN,0x0D, 0, 0);
  67. }
  68.  
  69. return TRUE;
  70. }
  71.  
  72. void restart()
  73. {
  74. cout << endl;
  75. cout << endl;
  76. main();
  77. willRestart = "null";
  78. text = "null";
  79. intervels = 0;
  80. numOfTimes = 0;
  81. start = "null";
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement