How to know the language of the code and compile it?

Asked

Viewed 42 times

0

I would like to know how to compile this code (and in what language it was written)?

I found him in a Tibia Forum (Game) where the goal is to make an Automatic Login whenever you open the game.

I have no idea how to compile a code.

Code:

    #include <iostream>
    #include <Windows.h>
    #include <string>

    //Tibia 600 x 500 client default size
    //Enter Game = 80x,300y
    //OK button = 400, 350

    int width = 0;
    int height = 0;
    RECT rect;

    std::string login = "seulogin";
    std::string password = "suasenha";

    int main()
    {

    std::cout << "Searching Tibia..." << std::endl;
    HWND hwndTibia = NULL;
    while (hwndTibia == NULL)
    {
        hwndTibia = ::FindWindow(NULL, "Tibia");
    }   

    if (hwndTibia)
    {
        std::cout << "Tibia found." << std::endl;   
        GetClientRect(hwndTibia, &rect);
        width = rect.left - rect.right;
        height = rect.bottom - rect.top;
        std::cout << "Resolution : Width: " << width << " Height: " << height << std::endl;
        //click Enter Game
        SendMessage(hwndTibia, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(80, 300));
        Sleep(25);
        SendMessage(hwndTibia, WM_LBUTTONUP, MK_LBUTTON, MAKELPARAM(80, 300));
        Sleep(100);     

        ////type login info, username/tab/password
        if (login.size() > 0 && password.size() > 0)
        {
            for (char& l : login)
            {
                SendMessage(hwndTibia, WM_CHAR, (int)l, NULL);
            }

            SendMessage(hwndTibia, WM_CHAR, 9, NULL);

            for (char& p : password)
            {
                SendMessage(hwndTibia, WM_CHAR, (int)p, NULL);
            }

        }

        ////click ok
        Sleep(50);
        SendMessage(hwndTibia, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(320, 345));
        Sleep(25);
        SendMessage(hwndTibia, WM_LBUTTONUP, MK_LBUTTON, MAKELPARAM(320, 345));     
    }

    return 0;
    }

1 answer

1


The code is written in C++. To compile you can use GCC, just look for how to install this tool which you will easily find. (don’t forget to add the gcc path in the environment variables). Once this is done, you can compile as follows:

  1. Open the terminal and go to the directory where the code is.
  2. Once you are in the code directory, just type in the terminal: g++ filename.cpp -the cutname
  3. Done, the file is compiled and an executable will be generated in the same folder.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.