Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Hello,


I'm building a simple program that sends emails. The program has 2 buttons start and cancel. If i click start it creates a thread a start sending email and updating a progress bar when i press cancel it stops the thread.

Now, i've managed to create the thread but it can't access the progress bar because it was created in another thread.

To solve this i've implement invoke the problem is that using invoke it locks the program similar to not be using threads at all.

I need to know how to fiz this urgent.

Cumpz,
Posted
Updated 17-Dec-11 9:23am
v3

Im sure 1 of Amir's links says this, but just use PostMessage[^] (instead of SendMessage) to update the progress bar from the thread. This places the request on the applications message queue, which is processed by the main thread.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900