RE: How to Know is a thread is alive by JoshChang
JoshChang
Mon May 21 05:27:00 CDT 2007
Hi Murthy,
Although it's a workaround by importing win32_CE API,
it's indeed a workable code segment....
Assume you use C#
using System.Threading;
using System.Runtime.InteropServices; // for using other APIs
[DllImport("coredll.dll")]
public unsafe static extern bool GetExitCodeThread(UInt32 hThread,
UInt32 * lpExitCode);
UInt32 eCode;
GetExitCodeThread((uint)Thread.CurrentThread.ManagedThreadId,
&eCode);
if (eCode == 0x00000103) // constant of STILL_ALIVE
{
MessageBox.Show("Thread still alive");
}
[Note] ..... to check "allow unsafe code" when you build your project.....
"Murthy" wrote:
> Hi,
> I know that there is a method isalive to know if a thread is alive in the
> framework.
> But how do i know if a thread is alive and running in compact framework.
>
> Is there any similar method in .net cf.....??
>
> Thanks in Advance,
> Murthy
>