Problem mit KeyboardHook



  • Ich versuche folgenden Tipp aus der FAQ zu nutzen:
    http://www.c-plusplus.net/forum/viewtopic-var-t-is-39383.html

    Nur leider kommen immer folgenden Fehlermeldungen:

    In file included from hookdll.c:1:
    hookdll.h:10: error: syntax error before "CALLBACK"

    hookdll.h:10: warning: parameter names (without types) in function declaration

    hookdll.h:10: warning: data definition has no type or storage class
    hookdll.h:11: error: syntax error before "CALLBACK"
    hookdll.h:11: warning: data definition has no type or storage class
    hookdll.c:12: error: syntax error before "hWindow"
    hookdll.c:12: warning: data definition has no type or storage class
    hookdll.c:21: error: syntax error before "CALLBACK"
    hookdll.c:21: error: syntax error before "WPARAM"

    hookdll.c:21: warning: data definition has no type or storage class
    hookdll.c:24: error: syntax error before "hhkHook"
    hookdll.c:24: warning: data definition has no type or storage class
    hookdll.c:25: error: syntax error before "hDllInstance"
    hookdll.c:25: warning: data definition has no type or storage class
    hookdll.c:35: error: syntax error before "DllMain"

    hookdll.c:35: error: syntax error before "hInstance"
    hookdll.c: In function DllMain': hookdll.c:36: error:fdwReason' undeclared (first use in this function)
    hookdll.c:36: error: (Each undeclared identifier is reported only once
    hookdll.c:36: error: for each function it appears in.)
    hookdll.c:37: error: DLL\_PROCESS\_ATTACH' undeclared (first use in this function) hookdll.c:40: error:hInstance' undeclared (first use in this function)

    hookdll.c:44: error: TRUE' undeclared (first use in this function) hookdll.c: At top level: hookdll.c:53: error: syntax error before "CALLBACK" hookdll.c:53: error: syntax error before "hParent" hookdll.c: In functionSetupHook':
    hookdll.c:54: error: hParent' undeclared (first use in this function) hookdll.c:56: error:WH_KEYBOARD' undeclared (first use in this function)
    hookdll.c:56: error: NULL' undeclared (first use in this function) hookdll.c:59: error:TRUE' undeclared (first use in this function)
    hookdll.c: At top level:
    hookdll.c:69: error: syntax error before "CALLBACK"
    hookdll.c:69: error: syntax error before "WPARAM"
    hookdll.c: In function KeyboardHookProc': hookdll.c:70: error:nCode' undeclared (first use in this function)
    hookdll.c:70: error: HC_ACTION' undeclared (first use in this function) hookdll.c:72: error:lParam' undeclared (first use in this function)

    hookdll.c:74: error: HWND' undeclared (first use in this function) hookdll.c:74: error: syntax error before "hWindow" hookdll.c:80: error:wParam' undeclared (first use in this function)

    hookdll.c: At top level:
    hookdll.c:91: error: syntax error before "CALLBACK"
    hookdll.c: In function UninstallHook': hookdll.c:94: error:TRUE' undeclared (first use in this function)

    make.exe: *** [hookdll.o] Error 1

    Ausführung beendet

    Wie kann ich diese Fehler beheben?



  • erstmal würde uns interessieren : welchen compiler verwendest du?
    und dann ohne mir die fehlermeldungen genau durchgelesen zu haben, scheint es mir, als ob du da irgendwas ziemlich falsch machst, wenn sie gleich in so einem rudel auftreten.

    also du solltest so vorgehen:

    ➡ neues projekt erstellen (wenn es die option dll-projekt gibt dann wähle die!)
    ➡ du musst beachten, dass der code auf eine header- und eine sourcedatei aufgeteilt werden muss. nicht einfach so durch den compiler jagen!
    ➡ wenn du ein normales konsolenprojekt gewählt hast, dann musst es jetzt noch auf dll umstellen
    ➡ nochmal checken ob alle libs und header am start sind (windows.h, user32.lib) und normal bauen, danach solltest du die entsprechende dll (ggf. mit lib) erhalten.


Anmelden zum Antworten