我包含了头文件 <winuser.h>在最开头定义了 #define        _WIN32_WINNT        0x0500
               #define        WIN_VER          0x0500
然后百度了所有能找到的方法但是最后的结果都是提示 未定义的WH_KEYBOARD_LL、WH_MOUSE_LL、KBDLLHOOKSTRUCT、MSLLHOOKSTRUCT
求大神解决,我都要疯了~~~~~~

解决方案 »

  1.   

    #define WH_KEYBOARD_LL 13
    #define WH_MOUSE_LL    14typedef struct {
      DWORD     vkCode;
      DWORD     scanCode;
      DWORD     flags;
      DWORD     time;
      ULONG_PTR dwExtraInfo;
    } KBDLLHOOKSTRUCT, *PKBDLLHOOKSTRUCT;typedef struct {
      POINT     pt;
      DWORD     mouseData;
      DWORD     flags;
      DWORD     time;
      ULONG_PTR dwExtraInfo;
    } MSLLHOOKSTRUCT, *PMSLLHOOKSTRUCT;直接将上面的结构和定义放到你的程序中去就肯定没问题啦。
      

  2.   

    winuser.h 里面的定义
    vs2008 我用的
    /*
     * SetWindowsHook() codes
     */
    #define WH_MIN              (-1)
    #define WH_MSGFILTER        (-1)
    #define WH_JOURNALRECORD    0
    #define WH_JOURNALPLAYBACK  1
    #define WH_KEYBOARD         2
    #define WH_GETMESSAGE       3
    #define WH_CALLWNDPROC      4
    #define WH_CBT              5
    #define WH_SYSMSGFILTER     6
    #define WH_MOUSE            7
    #if defined(_WIN32_WINDOWS)
    #define WH_HARDWARE         8
    #endif
    #define WH_DEBUG            9
    #define WH_SHELL           10
    #define WH_FOREGROUNDIDLE  11
    #if(WINVER >= 0x0400)
    #define WH_CALLWNDPROCRET  12
    #endif /* WINVER >= 0x0400 */#if (_WIN32_WINNT >= 0x0400)
    #define WH_KEYBOARD_LL     13
    #define WH_MOUSE_LL        14
    #endif // (_WIN32_WINNT >= 0x0400)#if(WINVER >= 0x0400)
    #if (_WIN32_WINNT >= 0x0400)
    #define WH_MAX             14
    #else
    #define WH_MAX             12
    #endif // (_WIN32_WINNT >= 0x0400)
    #else
    #define WH_MAX             11
    #endif#define WH_MINHOOK         WH_MIN
    #define WH_MAXHOOK         WH_MAX/*
     * Hook Codes
     */
    #define HC_ACTION           0
    #define HC_GETNEXT          1
    #define HC_SKIP             2
    #define HC_NOREMOVE         3
    #define HC_NOREM            HC_NOREMOVE
    #define HC_SYSMODALON       4
    #define HC_SYSMODALOFF      5