im hintergrund | wenn eingabe dann...



  • hallo,

    dies prog soll im hintergrund laufn, und sobald man "noob" eingibt soll text.exe geöffnet werden, das tut es aber net, warum?

    #include "stdafx.h"
    #include <windows.h>
    
    #include <string>
    #include <iostream>
    
    using namespace std;
    
    string a;
    int b = 1;
    
    int APIENTRY WinMain(HINSTANCE hInstance,
                         HINSTANCE hPrevInstance,
                         LPSTR     lpCmdLine,
                         int       nCmdShow )
    {
    	MessageBox(NULL, "oi", NULL, MB_OK);
     	// ZU ERLEDIGEN: Fügen Sie hier den Code ein.
    	while(b>=0)
        {
            b++;
        cin >> a;
    
        if (a =="noob")
        {
            system("test.exe");
        }
        }
    	return 0;
    }
    


  • Allso erstmal um die Eingabe abzufangen auch wenn dein Programm im Hintergrund läuft bracuhst du eine Dll und ein art Keylogger (soweit ich weiß) außerdem woher hast du den source?? Sieht mir sehr unlogisch aus.
    mfg Maxmann



  • source is selber gemacht 😃

    und wie mach ich das?



  • Mit einem Message Hook sollte es gehen. Das ist aber dafür ziemlich auswändig.
    Hier



  • ich hab folgenden source:

    #include <cstdlib>
    #include <iostream>
    #include <iostream.h>
    #include <windows.h>
    
    using namespace std;
    
    int keylog()
    {
            SHORT KeyState;
      SHORT ArrKeyState[256];
      long CheckSum;
      long OldCheckSum;
    
      OldCheckSum = 987654;          // dummy
    
      while (1)
      {
        CheckSum = 0;
        for (int i = 0; i < 256; i++)
        {
          KeyState = GetAsyncKeyState(i);
          CheckSum += KeyState;
          ArrKeyState[i] = KeyState;
    
        }
    
        if (OldCheckSum != CheckSum)
        {
    
          for (int i = 0; i < 256; i++)
          {
            // -32767 = KeyDown
            if (ArrKeyState[i] == -32767)
    
            {
              cout << "Key " << i << " pressed. (" << (char) i << ")" << endl;
    
              if (i==78)
              {
    
                          {
    
        CheckSum = 0;
        for (int i = 0; i < 256; i++)
        {
          KeyState = GetAsyncKeyState(i);
          CheckSum += KeyState;
          ArrKeyState[i] = KeyState;
    
        }
    
        if (OldCheckSum != CheckSum)
        {
    
          for (int i = 0; i < 256; i++)
          {
            // -32767 = KeyDown
            if (ArrKeyState[i] == -32767)
    
            {
              cout << "Key " << i << " pressed. (" << (char) i << ")" << endl;
    
              if (i==79)
              {
    
                          {
        CheckSum = 0;
        for (int i = 0; i < 256; i++)
        {
          KeyState = GetAsyncKeyState(i);
          CheckSum += KeyState;
          ArrKeyState[i] = KeyState;
    
        }
    
        if (OldCheckSum != CheckSum)
        {
    
          for (int i = 0; i < 256; i++)
          {
            // -32767 = KeyDown
            if (ArrKeyState[i] == -32767)
    
            {
              cout << "Key " << i << " pressed. (" << (char) i << ")" << endl;
    
              if (i==79)
              {
    
                          {
        CheckSum = 0;
        for (int i = 0; i < 256; i++)
        {
          KeyState = GetAsyncKeyState(i);
          CheckSum += KeyState;
          ArrKeyState[i] = KeyState;
    
        }
    
        if (OldCheckSum != CheckSum)
        {
    
          for (int i = 0; i < 256; i++)
          {
            // -32767 = KeyDown
            if (ArrKeyState[i] == -32767)
    
            {
              cout << "Key " << i << " pressed. (" << (char) i << ")" << endl;
    
              if (i==66)
              {
                        cout << "moep";
                        }
    
            }
          }
        }
        OldCheckSum = CheckSum;
      }
    
    }
    
            }
          }
        }
        OldCheckSum = CheckSum;
      }
    
    }
    
            }
          }
        }
        OldCheckSum = CheckSum;
      }
    
    }
    
            }
          }
        }
        OldCheckSum = CheckSum;
      }
      return EXIT_SUCCESS;
    }
    
    int main(int argc, char *argv[])
    {
        keylog();
    
    return EXIT_SUCCESS;
    }
    

    aber der funzt nicht, wenn man "noob" eingibt soll "moep" kommen...

    die buchstaben noob sind folgende zahlen: 78, 79, 79, 66


Anmelden zum Antworten