Advertisement
archlinuxorg

Untitled

Jun 22nd, 2017
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3. #include <tchar.h>
  4.  
  5. using namespace std;
  6.  
  7. char names[][16] = {"XXX", "XXX"};
  8. char passwords[][16] = {"YYY", "YYY"};
  9.  
  10.  
  11. void tryLogin(HWND hwnd, int accID){
  12. for(auto &ch: names[accID]){
  13. PostMessage(hwnd, WM_CHAR, ch, 0);
  14. }
  15. PostMessage(hwnd, WM_KEYDOWN, VK_TAB, 0);
  16. for(auto &ch: passwords[accID]){
  17. PostMessage(hwnd, WM_CHAR, ch, 0);
  18. }
  19. PostMessage(hwnd, WM_KEYDOWN, VK_RETURN, 0);
  20. }
  21.  
  22. int getRightTopWindowXPos(HWND hwnd){
  23. RECT wndrect;
  24. GetWindowRect(hwnd, &wndrect);
  25. int screenwidth = GetSystemMetrics(SM_CXSCREEN);
  26.  
  27. return screenwidth - wndrect.right + wndrect.left;
  28. }
  29.  
  30. int main(){
  31. STARTUPINFO si;
  32. PROCESS_INFORMATION pi;
  33.  
  34. //ZeroMemory( &si, sizeof(si) ); //Без понятия что это
  35. //si.cb = sizeof(si); //, слышал что так надо
  36. //ZeroMemory( &pi, sizeof(pi) ); // ^_^
  37.  
  38. CreateProcess( "D:\\WOW Wotlk 3.3.5a\\wow.exe",
  39. NULL, NULL, NULL, FALSE, 0, NULL, NULL,
  40. &si, &pi);
  41.  
  42. Sleep(3000);
  43.  
  44. HWND wnd = FindWindow(NULL, "World of Warcraft");
  45. int wndX = getRightTopWindowXPos(wnd);
  46.  
  47. SetWindowText(wnd, "WOWxx");
  48. SetWindowPos(wnd, HWND_TOP, wndX, 0, 0, 0, SWP_NOSIZE);
  49.  
  50. tryLogin(wnd, 1);
  51.  
  52. return 0;
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement