samedi 9 mai 2015

Error compiling c++ windows code in debian

I am new in using Debian with xfce and I want to compile a c++ code which require windows api. The error is windows.h is not found.

How can I run this code in debian:

#include <iostream>
#include <windows.h>

using namespace std;

int main(void) {

    int life = 100;

    HWND hWnd = NULL;

    while (hWnd == 0)
    {
        hWnd = FindWindowA(0, "MyApp");

        cout << "Waiting for Rastalia Fantasy ..." << endl;
        Sleep(200);
        system("cls");
    }

    if(hWnd != 0)
    {
        DWORD PID;
        GetWindowThreadProcessId(hWnd, &PID);
        HANDLE hProc = OpenProcess(PROCESS_ALL_ACCESS, false, PID);

        while (true)
        {
            if(!hProc) {
                cerr << "Cannot open process." << endl;
                break;
            } else {
                if(GetAsyncKeyState(VK_LCONTROL))
                {
                    int lifeResult = WriteProcessMemory(hProc, (LPVOID)0x00857D30, &life, (DWORD)sizeof(life), NULL);

                    if(lifeResult > 0){
                        clog << "Life changed." << endl;
                    }
                }
            }
        }

        CloseHandle(hProc);

        cin.get();
    }

    return 0;
}

I have installed mingw32 and wine but when I start, the program don't found MyApp.

Aucun commentaire:

Enregistrer un commentaire