请问这是一个什么错误?怎样解决?

解决方案 »

  1.   

    参数用的不对吧参考msdn很容易解决的
      

  2.   

    我是这样设的glhHook=SetWindowsHookEx(WH_KEYBOARD,KeyProc,glhInstance,0);
      

  3.   

    LRESULT WINAPI KeyProc(int nCode, WPARAM wParam, LPARAM lParam)
    你的函数原型错误应该向上面那样
      

  4.   

    改成这样:
    glhHook=SetWindowsHookEx(WH_KEYBOARD,(LPTHREAD_ROUTLINE)KeyProc,glhInstance,0);
      

  5.   

    我的函数原型是这样
    LRESULT WINAPI KeyProc(int nCode, WPARAM wParam, LPARAM lParam)
    glhHook=SetWindowsHookEx(WH_KEYBOARD,KeyProc,glhInstance,0);
    是怎么不行啊!!
      

  6.   

    LRESULT CALLBACK KeyProc(int nCode, WPARAM wParam, LPARAM lParam)
    试试看
      

  7.   

    glhHook=SetWindowsHookEx(WH_KEYBOARD,(HOOKPROC)KeyProc,glhInstance,0);
      

  8.   


    我的函数原型是这样
    LRESULT WINAPI KeyProc(int nCode, WPARAM wParam, LPARAM lParam)
    glhHook=SetWindowsHookEx(WH_KEYBOARD,KeyProc,glhInstance,0);
    改成
    LRESULT CALLBACK KeyProc(int nCode, WPARAM wParam, LPARAM lParam)
    glhHook=SetWindowsHookEx(WH_KEYBOARD,KeyProc,glhInstance,0);
      

  9.   

    我改成拉
    LRESULT CALLBACK KeyProc(int nCode, WPARAM wParam, LPARAM lParam)
    glhHook=SetWindowsHookEx(WH_KEYBOARD,KeyProc,glhInstance,0);
    还是出现error C2664: 'SetWindowsHookExA' : cannot convert parameter 2 from 'long (int,unsigned int,long)' to 'long (__stdcall *)(int,unsigned int,long)'
        None of the functions with this name in scope match the target type
      

  10.   

    glhHook=SetWindowsHookEx(WH_KEYBOARD,(HOOKPROC)KeyProc,glhInstance,0);
    试试看?
      

  11.   

    我改成 glhHook=SetWindowsHookEx(WH_KEYBOARD,(HOOKPROC)KeyProc,glhInstance,0); 
    可还是
    error C2440: 'type cast' : cannot convert from '' to 'long (__stdcall *)(int,unsigned int,long)'
            None of the functions with this name in scope match the target type