那个类发过来了,就是无法取得当前进程的id,
我调用test2()的时候,安装钩子返回127错误,说找不到该进程,
不知道该怎么办,哪位老兄能帮忙? m_hhook = SetWindowsHookEx(
m_hookType, 
m_filterFunc, 
(IntPtr)(Process.GetProcessesByName("test")[0].Handle), 
0);
GetProcessesByName("test")[0].Handle是有值的
GetProcessesByName("test")[0].Id是有值的
也不行,我该怎么办?

解决方案 »

  1.   

    有C#调用VC全局鼠键hook的例子吗?
      

  2.   

    我也要C#的全局钩子源码?有的话也给我发一份好吗[email protected]
      

  3.   

    http://support.microsoft.com/default.aspx?scid=kb;en-us;318804#3You cannot implement global hooks in Microsoft .NET Framework. To install a global hook, a hook must have a native dynamic-link library (DLL) export to inject itself in another process that requires a valid, consistent function to call into. This requires a DLL export, which .NET Framework does not support. Managed code has no concept of a consistent value for a function pointer because these function pointers are proxies that are built dynamically.
      

  4.   

    取当前进程的id:
    Process.GetCurrentProcess().HandleSetWindowsHookEx需要的是个DLL的handle,你传进程id进去干什么?
      

  5.   

    给我也发一份源码;
    [email protected]