/// <summary> /// Retrieves the context of the specified thread. /// </summary> /// <param name="handle"></param> public static ThreadContext GetThreadContext(IntPtr handle) { ThreadContext context = new ThreadContext { ThreadContextFlags = ThreadContextFlags.All }; if (!UnmanagedGetThreadContext(handle, ref context)) { throw new Win32Exception(); } return context; }
private static extern bool UnmanagedGetThreadContext(IntPtr hThread, ref ThreadContext lpThreadContext);