我有这样的课
class Keyboard
{
public:
Keyboard(void);
~Keyboard(void);
void SetHook(HINSTANCE hInstance);
LRESULT CALLBACK keyboardHookProc(int nCode, WPARAM wParam, LPARAM lParam);
};
LRESULT CALLBACK Keyboard::keyboardHookProc(int nCode, WPARAM wParam, LPARAM lParam)
{
bool bControlKeyDown=0;
bool caps = GetKeyState(VK_CAPITAL) < 0;
...
void Keyboard::SetHook(HINSTANCE hInstance)
{
KeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL, Keyboard::keyboardHookProc, hInstance, NULL);
}
但声明
KeyboardHook = SetWindowsHookEx(WH_KEYBOARD_LL, Keyboard::keyboardHookProc, hInstance, NULL);
导致编译错误
Error 7 error C3867: 'Keyboard::keyboardHookProc': function call missing argument list; use '&Keyboard::keyboardHookProc' to create a pointer to member
如果我更改为 '&Keyboard::keyboardHookProc' 它也会出错,当我转换为 '(HOOKPROC) &Keyboard::keyboardHookProc' 它也会出错
任何人请帮助