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());
- RECT rect;
- SetForegroundWindow(steam);
- SetFocus(steam);
- SetActiveWindow(steam);
- ShowWindow(steam,SW_SHOW);
- Sleep(1000);
- cout << GetWindowRect(steam,&rect) << endl;
- cout << "screen: " << steam << endl << "RectBottom: " << rect.bottom << endl << "RectTop: " << rect.top << endl << "RectRight: " << rect.right << endl << "RectLeft: " << rect.left << endl;
- POINT b;
- GetCursorPos(&b);
- cout << "x: " << b.x << " y: " << b.y << endl;
- double fScreenWidth = 1920;
- double fScreenHeight = 1080;
- double fx = 1150*(65535.0f/fScreenWidth);
- double fy = 446*(65535.0f/fScreenHeight);
- INPUT event;
- event.type = INPUT_MOUSE;
- event.mi.dx = fx;
- event.mi.dy = fy;
- event.mi.mouseData=0;
- event.mi.time=0;
- event.mi.dwFlags=(MOUSEEVENTF_ABSOLUTE|MOUSEEVENTF_MOVE|MOUSEEVENTF_LEFTDOWN|MOUSEEVENTF_LEFTUP);
- SendInput(1,&event,sizeof(INPUT));
- INPUT eventkey;
- eventkey.ki.dwFlags = KEYEVENTF_SCANCODE;
- eventkey.type = INPUT_KEYBOARD;
- event.ki.wVk = VK_F6;
- GetCursorPos(&b);
- cout << "x: " << b.x << " y: " << b.y << endl;
- /*while (1){ 1324 476
- GetCursorPos(&b);
- cout << "X: " << b.x << " Y: " << b.y << endl;
- }*/
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement