This is my code.

#include "pch.h"
#include <iostream>
#include <Windows.h> 
#include <string>
#include <ctime>
#include <fstream>

using namespace std;

std::string AppName = "League of Legends";
LPCSTR LAppWindow = "Riot Client";
std::string AppStatus;

bool IsAppAvil;
bool Update;

int main()
{
    //Start App
    ShellExecuteA(NULL,"open","D:\\Games\\Riot Games\\League of Legends\\LeagueClient.exe\\",NULL,NULL, SW_SHOWDEFAULT);

    //Checking if app is running
    HWND hGameWindow = NULL;
    int timeSinceLAstUpdate = clock();
    int AppAvailTMR = clock();
    int onePressTMR = clock();
    int Timer = 0;
    DWORD dwProcID = NULL;
    HANDLE hProcHandle = NULL;

    while(!GetAsyncKeyState(VK_ESCAPE))
    {
        Timer += 1;
        if (clock() - AppAvailTMR > 100)
        {
            AppAvailTMR = clock();
            IsAppAvil = false;

            hGameWindow = FindWindowA(NULL, LAppWindow);

            if (hGameWindow)
            {
                GetWindowThreadProcessId(hGameWindow, &dwProcID);
                if (dwProcID != 0)
                {
                    hProcHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcID);
                    if (hProcHandle == INVALID_HANDLE_VALUE || hProcHandle == NULL)
                    {
                        AppStatus = "Faild to open.Invalid HANDLE";
                    }
                    else
                    {
                        AppStatus = "App opend";
                        IsAppAvil = true;
                    }
                }
                else
                {
                    AppStatus = "Faild to open.Didn't get the process ID";
                }
            }
            else
            {
                AppStatus = "Faild to open.App not found";
            }
        }

            Sleep(1000);
            system("cls");
            cout << "-------------------------------------------------------------------" << endl;
            cout << "                      Auto App Loger" << endl;
            cout << "-------------------------------------------------------------------" << endl;
            cout << "APP STATUS: " << AppStatus << endl;
            cout << "[ESC] exit" <<endl;

    }

    return ERROR_SUCCESS;
}

void ReadTxt() 
{
    std::string line_;
    ifstream file_("Nam.Password.txt");
    if (file_.is_open())
    {
        std::cout << "Reading file" << '\n' << endl;
        while (getline(file_, line_))
        {
            std::cout << line_ << '\n' << endl;
        }
    }
    else
    {
        std::cout << "File not found" << '\n' << endl;
    }
}

Recommended Answers

All 3 Replies

That's nearly 100 lines of code, and I don't see "last" or "text" so you'll have to point out what text you are asking about along with the line number.

Line 87,90,95 text dosen't appear into my console.

Nowhere in the posted code do you call ReadTxt. That;s probably why it's never executed, which is why you don't see its output.

See how much better this site works when you give all the relevant info?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.