创建键盘挂钩时发生编译器错误

| 我正在向自己介绍如何在Win32 C ++中使用挂钩(特别是KeyboardHooks),并且遇到问题。 首先,我试图创建/声明一个HHook对象,但是当我这样做时,Microsoft Visual C ++给出了一个编译器错误,指出:
c:\\users\\soribo\\desktop\\c++ programming\\visual c++ programming\\testhhook\\testhhook\\testhhook.cpp(7): error C2146: syntax error : missing \';\' before identifier \'keyboardHook\'

1>c:\\users\\soribo\\desktop\\c++ programming\\visual c++ programming\\testhhook\\testhhook\\testhhook.cpp(7): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int

1>c:\\users\\soribo\\desktop\\c++ programming\\visual c++ programming\\testhhook\\testhhook\\testhhook.cpp(7): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
这是生成此错误的代码行:
HHook keyboardHook; 
使用HHook类需要包括哪些Windows库?我已经做好了
#include <windows.h>
我的另一个问题是,使用这些挂钩是否需要UAC? 编辑:使用更多代码:
// TestHHook.cpp : Defines the entry point for the application.
//

     #include <windows.h>
#include \"stdafx.h\"
#include \"TestHHook.h\"

static HHook keyboardHook;
#define MAX_LOADSTRING 100

// Global Variables:
HINSTANCE hInst;                                // current instance
TCHAR szTitle[MAX_LOADSTRING];                  // The title bar text
TCHAR szWindowClass[MAX_LOADSTRING];            // the main window class name

// Forward declarations of functions included in this code module:
ATOM                MyRegisterClass(HINSTANCE hInstance);
BOOL                InitInstance(HINSTANCE, int);
LRESULT CALLBACK    WndProc(HWND, UINT, WPARAM, LPARAM);
INT_PTR CALLBACK    About(HWND, UINT, WPARAM, LPARAM);
    
已邀请:
        您正在使用区分大小写的语言。是挂钩,不是挂钩。     

要回复问题请先登录注册