Announcement

Collapse
No announcement yet.

Wiedermal Hooks!???!

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Wiedermal Hooks!???!

    warum wird die Funktion (Keyboardproc) beim Keyboardanschlag nicht ausgeführt? Habe mir die anderen posts schon durchgelesen, und werde dadurch nicht schlau. moechte mal ein "GAAANZ" kleines programm haben, welches im hintergrund laueft und tastaturanschläge abfaengt.
    vielen dank im vorraus!

    mfg

    #include "windows.h"
    #include "stdio.h"

    HHOOK g_hHookRecorder = NULL;

    LRESULT CALLBACK KeyboardProc(int nCode, WPARAM wParam, LPARAM lParam){

    char msg[256];

    sprintf(msg,"%d %d %d",nCode, wParam, lParam);
    MessageBox(0,msg,"test",0);

    return (CallNextHookEx(g_hHookRecorder, nCode, wParam, lParam));
    };

    int WINAPI WinMain(
    HINSTANCE hInstance, // handle to current instance
    HINSTANCE hPrevInstance, // handle to previous instance
    LPSTR lpCmdLine, // pointer to command line
    int nCmdShow // show state of window
    )
    {

    SetWindowsHookEx(WH_KEYBOARD, KeyboardProc,hInstance,0);

    while(1==1) {
    int d_ergebnis = 0;
    SleepEx(10000,1);
    d_ergebnis = MessageBox(0, "Programm fortsetzen?", "Hooker",MB_YESNO);
    if (d_ergebnis == IDNO) break;
    };


    UnhookWindowsHookEx( g_hHookRecorder );

    return TRUE;

    }

  • #2
    ..
    g_hHookRecorder = SetWindowsHookEx(WH_KEYBOARD, KeyboardProc,hInstance,0);
    ..

    habe ich schon verbessert!

    trotzdem gehts net!

    was is los?

    dank

    Comment


    • #3
      Systemweite Hooks müssen in einer DLL implementiert werden (sieht in Deinem Beispiel nicht so aus)

      Gruß Nic

      Comment

      Working...
      X