B
bazad
Hi,
I'd like to understand consequences of Application.DoEvents call.
Does it create a new thread?
Thank you
I'd like to understand consequences of Application.DoEvents call.
Does it create a new thread?
Thank you
bazad said:Hi,
I'd like to understand consequences of Application.DoEvents call.
Does it create a new thread?
Thank you
Willy Denoyette said:No, it doesn't create a new thread, it 'possibly' runs a modal message loop
(peekmessage/getmessage/dispatchmessage stuff) on the current thread.
'possibly' here means- under certain conditions- like a window handle
associated with the thread, and running an interactive session.
Willy.
Does this mean that user can click on menu items while main UI thread
is busy?
Willy Denoyette said:I guess you are hiding something behind this question .
The main UI thread runs his own message loop, so calling DoEvents is not
needed to have a responsive UI. If the UI is not responsive, it's an
indication for a blocked waiting thread, so including DoEvents in your code
won't help as it won't execute.
Willy.
bazad said:I guess I do
I have a button click event handler which takes a while to execute.
During the execution of the event handler the UI does not repaint
itself. I thought that I could use DoEvents inside some loop which
takes time to execute.
Willy Denoyette said:I guess you are hiding something behind this question .
The main UI thread runs his own message loop, so calling DoEvents is not
needed to have a responsive UI. If the UI is not responsive, it's an
indication for a blocked waiting thread, so including DoEvents in your code
won't help as it won't execute.
bazad said:I have a button click event handler which takes a while to execute.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.