Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <windows.h>
- #include <tchar.h>
- using namespace std;
- char names[][16] = {"XXX", "XXX"};
- char passwords[][16] = {"YYY", "YYY"};
- void tryLogin(HWND hwnd, int accID){
- for(auto &ch: names[accID]){
- PostMessage(hwnd, WM_CHAR, ch, 0);
- }
- PostMessage(hwnd, WM_KEYDOWN, VK_TAB, 0);
- for(auto &ch: passwords[accID]){
- PostMessage(hwnd, WM_CHAR, ch, 0);
- }
- PostMessage(hwnd, WM_KEYDOWN, VK_RETURN, 0);
- }
- int getRightTopWindowXPos(HWND hwnd){
- RECT wndrect;
- GetWindowRect(hwnd, &wndrect);
- int screenwidth = GetSystemMetrics(SM_CXSCREEN);
- return screenwidth - wndrect.right + wndrect.left;
- }
- int main(){
- STARTUPINFO si;
- PROCESS_INFORMATION pi;
- //ZeroMemory( &si, sizeof(si) ); //Без понятия что это
- //si.cb = sizeof(si); //, слышал что так надо
- //ZeroMemory( &pi, sizeof(pi) ); // ^_^
- CreateProcess( "D:\\WOW Wotlk 3.3.5a\\wow.exe",
- NULL, NULL, NULL, FALSE, 0, NULL, NULL,
- &si, &pi);
- Sleep(3000);
- HWND wnd = FindWindow(NULL, "World of Warcraft");
- int wndX = getRightTopWindowXPos(wnd);
- SetWindowText(wnd, "WOWxx");
- SetWindowPos(wnd, HWND_TOP, wndX, 0, 0, 0, SWP_NOSIZE);
- tryLogin(wnd, 1);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement