Home » U++ Library support » U++ MT-multithreading and servers » How to update main thread UI when runing other thread
Re: How to update main thread UI when runing other thread [message #24969 is a reply to message #24964] |
Sat, 06 February 2010 14:04 |
jiuzhi
Messages: 10 Registered: October 2009
|
Promising Member |
|
|
I take a look at GuiMT. But it isn't what I want.In GuiMT,it create a task thread,But it does not need to wait for returned results
What I mean is waiting a task thread do a task and return result to main thread block;
The task thread use GuiLock to refresh UI.But under U++,when main thread waiting,the task thread call Ctrl::Refresh look does not work.
In U++,I can only find a way to do this job,create task thread,and then create a waiting thread.It is cumbersome.
I cann't write code to be waiting in the main thread,otherwise the task thread cann't refresh UI.
in delphi, only main thread does GUI too.But it can do this job in the main thread.
begin ///this block run in the main thread
create and run task thread......
create and run task thread......
Application.processmessage;///refresh UI immediately. In U++,it does not work.
create and run task thread......
create and run task thread......
do some job......
end
OR:
begin ///this block run in the main thread
create and run task thread......
create and run task thread......
while not result do begin ///wait the task thread result and refresh UI. In U++, this will lock the GUI,other threads try to refresh the interface does not work
sleep(100);
Application.processmessage;///In delphi,this code is used to process GUI message in the main thread
end;
do some job......
end
What I would like to know is the routine which does the same function in U++ like Application.Processmessage in delphi?
[Updated on: Sat, 06 February 2010 14:13] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Sat May 11 07:31:05 CEST 2024
Total time taken to generate the page: 0.02376 seconds
|