handling threads in .net compact framework..

I am writing a program for pocketpc, using VS.net 2003
but i can only use Thd.start(), but can't use .Abort() or suspend

any way to solve this problem?

it is very urgent, extra points will be awarded...
thanks !!!
LVL 5
ho_alanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

surajgupthaCommented:
Because the .NET Compact Framework does not support the Thread.Abort and Thread.Stop methods, an application should stop all thread processes before allowing itself to close.
0
surajgupthaCommented:
0
smalleeCommented:
For reference

http://samples.gotdotnet.com/quickstart/CompactFramework/doc/controlinvoker.aspx




Closing threaded applications

Because the .NET Compact Framework does not support the Thread.Stop and Thread.Abort methods, you must be sure that no threads are running when you close a form. This QuickStart overrides the OnClosing method to cancel closing the form when the OK button, in the upper-right corner of the form, is clicked.

Note that a Pocket PC application with an OK button closes the form, and an application with an X button minimizes the form. For information about switching these buttons, see the Pocket PC Form Styles QuickStart. This QuickStart requires an OK button so that the Closing event is raised in order to use the OnClosing method.

Both the OnClosing and CloseButton_Click methods, as shown in the following code example, set the codeRequested variable to true. Only when the thread determines that this variable is true in the ThreadProc method does the thread close the form. The thread closes the form by using ControlInvoker.Invoke to invoke the CloseForm method.


// Set the closeRequested variable to true. This ensures that the
// Close button will not allow the application to close unless
// the thread has stopped running. When the ThreadProc method
// determines that closeRequested is true, it closes the application.
private void CloseButton_Click(object sender, System.EventArgs e) {
      closeRequested = true;
}

// The OnClosing override is called when the user clicks the OK
// button so that the application does not close until the thread
// has stopped running.
protected override void OnClosing(CancelEventArgs e)
{
   if (this.threadRunning)      
   {
      e.Cancel = true;
      MessageBox.Show("Application will close when thread has stopped running.");
   }
  closeRequested = true;
}





0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ho_alanAuthor Commented:
thanks all
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.