Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _WIN32_WINNT 0x0500
- #include <windows.h>
- #include <iostream>
- #include <fstream>
- #include <vector>
- #include <algorithm>
- #include <sstream>
- #include <shellapi.h>
- #include <Lmcons.h>
- #include <cstring>
- #include <tlhelp32.h>
- #include <string.h>
- #include <stdlib.h>
- const int number_max = 100;
- using namespace std;
- struct userpw{
- userpw(string _name, string string_pw):
- name(_name),
- pw(string_pw) {}
- string name;
- string pw;
- };
- bool checkIfClosed()
- {
- bool ret = true;
- char procName[] = "Steam.exe";
- PROCESSENTRY32 entry;
- entry.dwSize = sizeof(PROCESSENTRY32);
- HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
- if (Process32First(snapshot, &entry)){
- while (Process32Next(snapshot,&entry)){
- if (strcmp(entry.szExeFile, procName) == 0){
- HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, entry.th32ProcessID);
- TerminateProcess(hProcess,1);
- WaitForSingleObject(hProcess,INFINITE);
- CloseHandle(hProcess);
- ret = false;
- break;
- }
- }
- }
- CloseHandle(snapshot);
- return ret;
- }
- void getDesktopRes()
- {
- RECT desktop;
- const HWND hDesktop = GetDesktopWindow();
- }
- int main()
- {
- char username[UNLEN+1];
- DWORD username_len = UNLEN+1;
- GetUserName(username, &username_len);
- HWND m_hWnd;
- vector<userpw> hej;
- string user;
- fstream obj("C:\\Users\\wille\\Desktop\\password\\pws.txt", fstream::in | fstream::out);
- fstream obj2("C:\\Users\\wille\\Desktop\\password\\direction.txt", fstream::in);
- while(getline(obj,user)){
- size_t found = user.find(' ');
- hej.push_back(userpw(user.substr(0,found),user.substr(found+1,user.length())));
- }
- int Count = 1;
- for (vector<userpw>::iterator itr = hej.begin(); itr != hej.end(); ++itr){;
- cout << "#" << Count << "\nUser: " << itr->name << "\npassword: " << itr->pw << endl << endl;
- Count++;
- }
- string number;
- do{
- cout << "Select a number please: \n";
- getline(cin,number);
- }while(!(stoi( number ) > 0 && stoi( number ) < number_max));
- stringstream path;
- string path_defined;
- path << "C:\\Program Files (x86)\\Steam\\Steam.exe";
- if (obj2.is_open()){
- getline(obj2,path_defined);
- }
- //checkIfClosed();
- ShellExecute( m_hWnd,"open",(obj2.is_open() ? path_defined.c_str() : path.str().c_str()),"","", SW_SHOW );
- string _str = "Logga in – Steam";
- HWND steam = FindWindow(NULL,_str.c_str());
- LPRECT rect;
- SetForegroundWindow(steam);
- SetFocus(steam);
- SetActiveWindow(steam);
- ShowWindow(steam,SW_SHOW);
- Sleep(1000);
- cout << GetWindowRect(steam,rect) << endl;
- DWORD err = GetLastError();
- cout << endl << err << endl;
- cout << "screen: " << steam << endl << "Rect1: " << rect->bottom << endl << "Rect2: " << rect->left << endl << "Rect3: " << rect->right << endl << "Rect4: " << rect->top << endl;
- /* INPUT event;
- event.type = INPUT_MOUSE;
- event.mi.dx = 1920-rect->right;
- event.mi.dy = 500;
- SendInput(1,&event,sizeof(INPUT));*/
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement