C# GetThreadContext

Aug 18 2007 2:31 PM
Hi, I need the Context Switch of a thread and I could find the thread ID, but there is no way to reach the Context in C#! so I tried to use the GetThreadContext function of kernel32.dll and it was like this in MSDN:

BOOL GetThreadContext(
HANDLE hThread,
LPCONTEXT lpContext
);

And

[DllImport("kernel32.dll", SetLastError=true)]
static extern int GetThreadContext ( int hThread, ref CONTEXT lpContext)

but I can not use it cause I don't know what I should pass to the LPCONTEXT parameter!

Could anyone explain it for me with an example please?


Answers (4)