hhook=SetWindowsHookEx(WH_MOUSE,(HOOKPROC)MouseProc,
     (HINSTANCE)NULL,GetCurrentThreadId());这样试试看

解决方案 »

  1.   

    把它声明成静态。    static LRESULT CALLBACK MouseProc(int nCode,WPARAM wParam,LPARAM lParam
      

  2.   

    我改过来了,现在可以运行,但在还是让word接管了我的鼠标消息,因为前面的SetWindowsEx()
    函数的第四个参数是GetCurrentThreadID(),如要取得WORD的消息的话,我应该得到word 的 线程ID。。
    怎么样得到这个ID 呢??
      

  3.   

    用COleClientItem::GetInPlaceWindow();获得激活的窗口。再用GetWindowThreadProcessId
    The GetWindowThreadProcessId function retrieves the identifier of the thread that created the specified window and, optionally, the identifier of the process that created the window. DWORD GetWindowThreadProcessId(
      HWND hWnd,             // handle to window
      LPDWORD lpdwProcessId  // process identifier
    );取得进程ID.
      

  4.   

    另外你尝试不要传递进程指针。即
    SetWindowsHookEx(WH_MOUSE,(HOOKPROC)MouseProc,(HINSTANCE)NULL,NULL);