Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <cstring>
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- void toClipboard(const std::string &s){
- HWND hwnd = GetDesktopWindow();
- OpenClipboard(hwnd);
- EmptyClipboard();
- HGLOBAL hg=GlobalAlloc(GMEM_MOVEABLE,s.size()+1);
- if (!hg){
- CloseClipboard();
- return;
- }
- memcpy(GlobalLock(hg),s.c_str(),s.size()+1);
- GlobalUnlock(hg);
- SetClipboardData(CF_TEXT,hg);
- CloseClipboard();
- GlobalFree(hg);
- }
- int main()
- {
- bool Spam = false;
- string Tekst;
- cout << "Podaj tekst:";
- getline(cin, Tekst);
- toClipboard(Tekst);
- int Speed = 1;
- cout << "Podaj Predkosc w MS:";
- cin >> Speed;
- cout << "START/STOP F9" << endl;
- while(0==0)
- {
- if(GetAsyncKeyState(VK_F9))
- {
- Spam = !Spam;
- Sleep(200);
- }
- if(Spam)
- {
- keybd_event(VK_CONTROL,0,0 , 0); // Press
- Sleep(1);
- keybd_event((int)'V',0,0 , 0); // Press
- Sleep(1);
- keybd_event((int)'V',0,KEYEVENTF_KEYUP,0); // Release
- Sleep(1);
- keybd_event(VK_CONTROL,0,KEYEVENTF_KEYUP,0); // Release
- Sleep(1);
- keybd_event(VK_RETURN,0,0 , 0); //Alt Press
- Sleep(1);
- keybd_event(VK_RETURN,0,KEYEVENTF_KEYUP,0); // Alt Release
- Sleep(1);
- }
- Sleep(Speed);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement