Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
- VOID CALLBACK FloodTimer( HWND window, UINT Msg, UINT_PTR EventID, DWORD SYSTime);
- HWND MenuItems[4];
- int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
- LPSTR lpCmdLine, int nCmdShow )
- {
- MSG msg ;
- WNDCLASS wc;
- ZeroMemory(&wc, sizeof(wc));
- wc.lpszClassName = TEXT( "Flooder" );
- wc.hInstance = hInstance ;
- wc.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
- wc.lpfnWndProc = WndProc ;
- wc.hCursor = LoadCursor(0, IDC_ARROW);
- RegisterClass(&wc);
- CreateWindow( wc.lpszClassName, TEXT("Flooder"),
- WS_SYSMENU | WS_VISIBLE,
- 150, 150, 230, 150, 0, 0, hInstance, 0);
- while( GetMessage(&msg, NULL, 0, 0)) {
- TranslateMessage(&msg);
- DispatchMessage(&msg);
- }
- return (int) msg.wParam;
- }
- LRESULT CALLBACK WndProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
- {
- switch(msg)
- {
- case WM_CREATE:
- {
- MenuItems[0] = CreateWindow(TEXT("edit"), TEXT("Текст..."),
- WS_VISIBLE | WS_CHILD | WS_BORDER,
- 0, 0, 225, 25,
- hwnd, (HMENU) 1, NULL, NULL);
- MenuItems[1] = CreateWindow(TEXT("button"), TEXT("Флудить!"),
- WS_VISIBLE | WS_CHILD ,
- 120, 50, 80, 25,
- hwnd, (HMENU) 2, NULL, NULL);
- MenuItems[2] = CreateWindow(TEXT("edit"), TEXT("100"),
- WS_VISIBLE | WS_CHILD | WS_BORDER,
- 25, 50, 80, 25,
- hwnd, (HMENU) 3, NULL, NULL);
- MenuItems[3] = CreateWindow(TEXT("button"), TEXT("Стоп"),
- WS_VISIBLE | WS_CHILD ,
- 120, 75, 80, 25,
- hwnd, (HMENU) 4, NULL, NULL);
- break;
- }
- case WM_COMMAND:
- {
- if(HIWORD(wParam) == BN_CLICKED){
- if (LOWORD(wParam) == 2) {
- KillTimer(hwnd, 1);
- TCHAR speed[16];
- GetWindowText(MenuItems[2], speed, sizeof(speed));
- SetTimer(hwnd, 1, _wtoi(speed), FloodTimer);
- } else if(LOWORD(wParam) == 4)
- {
- KillTimer(hwnd, 1);
- }
- }
- break;
- }
- case WM_DESTROY:
- {
- KillTimer(hwnd, 1);
- PostQuitMessage(0);
- break;
- }
- }
- return DefWindowProc(hwnd, msg, wParam, lParam);
- }
- VOID CALLBACK FloodTimer( HWND window, UINT Msg, UINT_PTR EventID, DWORD SYSTime)
- {
- TCHAR* buff = (TCHAR*)calloc(1024, sizeof(TCHAR));
- GetWindowText(MenuItems[0], buff, 1024);
- KEYBDINPUT KbInput;
- ZeroMemory(&KbInput, sizeof(KEYBDINPUT));
- INPUT Input;
- ZeroMemory(&Input, sizeof(INPUT));
- TCHAR* ch = buff;
- while(*ch)
- {
- KbInput.wScan = *ch;
- KbInput.dwFlags = KEYEVENTF_UNICODE;
- Input.type = INPUT_KEYBOARD;
- Input.ki = KbInput;
- SendInput(1,&Input,sizeof(Input));
- KbInput.wScan = *(ch++);
- KbInput.dwFlags = KEYEVENTF_UNICODE | KEYEVENTF_KEYUP;
- Input.type = INPUT_KEYBOARD;
- Input.ki = KbInput;
- SendInput(1,&Input,sizeof(Input));
- }
- keybd_event(VK_RETURN, NULL, KEYEVENTF_EXTENDEDKEY, NULL);
- keybd_event(VK_RETURN, NULL, KEYEVENTF_EXTENDEDKEY | KEYEVENTF_KEYUP, NULL);
- free(buff);
- }
Advertisement
Add Comment
Please, Sign In to add comment