Advertisement
Guest User

Untitled

a guest
Apr 8th, 2018
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.39 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.  
  18.  
  19. const int number_max = 100;
  20. using namespace std;
  21.  
  22. struct userpw{
  23. userpw(string _name, string string_pw):
  24. name(_name),
  25. pw(string_pw) {}
  26.  
  27. string name;
  28. string pw;
  29. };
  30.  
  31. bool checkIfClosed()
  32. {
  33. bool ret = true;
  34. char procName[] = "Steam.exe";
  35. PROCESSENTRY32 entry;
  36. entry.dwSize = sizeof(PROCESSENTRY32);
  37.  
  38. HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
  39.  
  40. if (Process32First(snapshot, &entry)){
  41. while (Process32Next(snapshot,&entry)){
  42. if (strcmp(entry.szExeFile, procName) == 0){
  43. HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, entry.th32ProcessID);
  44. TerminateProcess(hProcess,1);
  45. WaitForSingleObject(hProcess,INFINITE);
  46. CloseHandle(hProcess);
  47. ret = false;
  48. break;
  49. }
  50. }
  51. }
  52. CloseHandle(snapshot);
  53.  
  54. return ret;
  55. }
  56.  
  57. void getDesktopRes()
  58. {
  59. RECT desktop;
  60. const HWND hDesktop = GetDesktopWindow();
  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. LPRECT 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. DWORD err = GetLastError();
  117. cout << endl << err << endl;
  118. cout << "screen: " << steam << endl << "Rect1: " << rect->bottom << endl << "Rect2: " << rect->left << endl << "Rect3: " << rect->right << endl << "Rect4: " << rect->top << endl;
  119.  
  120.  
  121.  
  122.  
  123. /* INPUT event;
  124. event.type = INPUT_MOUSE;
  125. event.mi.dx = 1920-rect->right;
  126. event.mi.dy = 500;
  127. SendInput(1,&event,sizeof(INPUT));*/
  128.  
  129. return 0;
  130.  
  131. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement