Advertisement
Guest User

Untitled

a guest
Apr 8th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.12 KB | None | 0 0
  1. #define _WIN32_WINNT 0x0500
  2.  
  3. #include <windows.h>
  4. #include <iostream>
  5. #include <fstream>
  6. #include <vector>
  7. #include <algorithm>
  8. #include <sstream>
  9. #include <shellapi.h>
  10. #include <Lmcons.h>
  11. #include <cstring>
  12. #include <tlhelp32.h>
  13. #include <string.h>
  14. #include <stdlib.h>
  15.  
  16.  
  17. const int number_max = 100;
  18. using namespace std;
  19.  
  20. struct userpw{
  21. userpw(string _name, string string_pw):
  22. name(_name),
  23. pw(string_pw) {}
  24.  
  25. string name;
  26. string pw;
  27. };
  28.  
  29. bool checkIfClosed()
  30. {
  31. bool ret = true;
  32. char procName[] = "Steam.exe";
  33. PROCESSENTRY32 entry;
  34. entry.dwSize = sizeof(PROCESSENTRY32);
  35.  
  36. HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
  37.  
  38. if (Process32First(snapshot, &entry)){
  39. while (Process32Next(snapshot,&entry)){
  40. if (strcmp(entry.szExeFile, procName) == 0){
  41. HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, entry.th32ProcessID);
  42. TerminateProcess(hProcess,1);
  43. WaitForSingleObject(hProcess,INFINITE);
  44. CloseHandle(hProcess);
  45. ret = false;
  46. break;
  47. }
  48. }
  49. }
  50. CloseHandle(snapshot);
  51.  
  52. return ret;
  53. }
  54.  
  55. void getDesktopRes()
  56. {
  57. RECT desktop;
  58. const HWND hDesktop = GetDesktopWindow();
  59.  
  60. }
  61.  
  62.  
  63.  
  64. int main()
  65. {
  66. char username[UNLEN+1];
  67. DWORD username_len = UNLEN+1;
  68. GetUserName(username, &username_len);
  69. HWND m_hWnd;
  70.  
  71. vector<userpw> hej;
  72. string user;
  73. fstream obj("C:\\Users\\wille\\Desktop\\password\\pws.txt", fstream::in | fstream::out);
  74. fstream obj2("C:\\Users\\wille\\Desktop\\password\\direction.txt", fstream::in);
  75.  
  76. while(getline(obj,user)){
  77.  
  78. size_t found = user.find(' ');
  79. hej.push_back(userpw(user.substr(0,found),user.substr(found+1,user.length())));
  80.  
  81. }
  82.  
  83. int Count = 1;
  84. for (vector<userpw>::iterator itr = hej.begin(); itr != hej.end(); ++itr){;
  85. cout << "#" << Count << "\nUser: " << itr->name << "\npassword: " << itr->pw << endl << endl;
  86. Count++;
  87. }
  88.  
  89. string number;
  90. do{
  91. cout << "Select a number please: \n";
  92. getline(cin,number);
  93.  
  94. }while(!(stoi( number ) > 0 && stoi( number ) < number_max));
  95.  
  96.  
  97. stringstream path;
  98. string path_defined;
  99. path << "C:\\Program Files (x86)\\Steam\\Steam.exe";
  100.  
  101. if (obj2.is_open()){
  102. getline(obj2,path_defined);
  103. }
  104.  
  105. //checkIfClosed();
  106. ShellExecute( m_hWnd,"open",(obj2.is_open() ? path_defined.c_str() : path.str().c_str()),"","", SW_SHOW );
  107. string _str = "Logga in – Steam";
  108. HWND steam = FindWindow(NULL,_str.c_str());
  109. RECT rect;
  110. SetForegroundWindow(steam);
  111. SetFocus(steam);
  112. SetActiveWindow(steam);
  113. ShowWindow(steam,SW_SHOW);
  114. Sleep(1000);
  115. cout << GetWindowRect(steam,&rect) << endl;
  116. cout << "screen: " << steam << endl << "RectBottom: " << rect.bottom << endl << "RectTop: " << rect.top << endl << "RectRight: " << rect.right << endl << "RectLeft: " << rect.left << endl;
  117.  
  118.  
  119.  
  120. POINT b;
  121. GetCursorPos(&b);
  122. cout << "x: " << b.x << " y: " << b.y << endl;
  123.  
  124. double fScreenWidth = 1920;
  125. double fScreenHeight = 1080;
  126. double fx = 1150*(65535.0f/fScreenWidth);
  127. double fy = 446*(65535.0f/fScreenHeight);
  128.  
  129.  
  130. INPUT event;
  131. event.type = INPUT_MOUSE;
  132. event.mi.dx = fx;
  133. event.mi.dy = fy;
  134. event.mi.mouseData=0;
  135. event.mi.time=0;
  136. event.mi.dwFlags=(MOUSEEVENTF_ABSOLUTE|MOUSEEVENTF_MOVE|MOUSEEVENTF_LEFTDOWN|MOUSEEVENTF_LEFTUP);
  137. SendInput(1,&event,sizeof(INPUT));
  138.  
  139. INPUT eventkey;
  140. eventkey.ki.dwFlags = KEYEVENTF_SCANCODE;
  141. eventkey.type = INPUT_KEYBOARD;
  142. event.ki.wVk = VK_F6;
  143. GetCursorPos(&b);
  144. cout << "x: " << b.x << " y: " << b.y << endl;
  145. /*while (1){ 1324 476
  146. GetCursorPos(&b);
  147. cout << "X: " << b.x << " Y: " << b.y << endl;
  148. }*/
  149. return 0;
  150.  
  151.  
  152.  
  153.  
  154.  
  155. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement