使用WINDOWS API函数代替获取当前实例的函数:
用:
[DllImport("kernel32.dll")]
public static extern IntPtr GetModuleHandle(string name);
GetModuleHandle(Process.GetCurrentProcess().MainModule.ModuleName)
代替:
Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()[0])
当作 SetWindowsHookEx 的第三个参数: IntPtr hInstance