Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <stdio.h>
- #include <Windows.h>
- #include "winuser.h"
- #include "tchar.h"
- #include <string>
- #include <time.h>
- using namespace std;
- bool spamBot(string text, int intervels, int numOfTimes);
- void sleep( time_t delay );
- void restart();
- string willRestart;
- string text;
- int intervels;
- int numOfTimes;
- string start;
- int main()
- {
- std::string text;
- std::cout << "Insert Desired Text: " << endl;
- getline(cin, text);
- std::cout << "Set Intervel: " << endl;
- std::cin >> intervels;
- std::cout << "Set Number of Times: " << endl;
- std::cin >> numOfTimes;
- std::cout << "Would you like to start? y/n: ";
- std::cin >> start;
- if (start == "y")
- {
- cout << "5" << endl;
- Sleep(1000);
- cout << "4" << endl;
- Sleep(1000);
- cout << "3" << endl;
- Sleep(1000);
- cout << "2" << endl;
- Sleep(1000);
- cout << "1" << endl;
- Sleep(1000);
- spamBot(text, intervels, numOfTimes);
- }
- if (start == "n")
- {
- return 0;
- }
- cout << "Would you like to restart? y/n: ";
- cin >> willRestart;
- if(willRestart == "y")
- {
- restart();
- }
- }
- bool spamBot(string text, int x, int y)
- {
- HWND spamWindow = GetForegroundWindow(); //problem starts here, only keystrokes notepad help!
- if(spamWindow == NULL)
- return FALSE;
- //Handle of notepad control
- HWND edit = FindWindowEx( spamWindow, NULL, _T( "Edit" ), NULL );
- if(edit == NULL)
- return FALSE;
- for(int z=0;z<y;z++)
- {
- SendMessage(edit, EM_REPLACESEL, (WPARAM)TRUE, (LPARAM)text.c_str());
- Sleep(5);
- keybd_event(VK_RETURN,0x0D, 0, 0);
- }
- return TRUE;
- }
- void restart()
- {
- cout << endl;
- cout << endl;
- main();
- willRestart = "null";
- text = "null";
- intervels = 0;
- numOfTimes = 0;
- start = "null";
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement