Hi,
I'd like to understand consequences of Application.DoE vents call.
Does it create a new thread?
Thank you 24 3291
"bazad" <no****@noreply .not> wrote in message
news:1099593932 .4+jIsAHupOrTgT hYXFT72g@terane ws... Hi,
I'd like to understand consequences of Application.DoE vents call. Does it create a new thread?
Thank you
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.
"Willy Denoyette [MVP]" <wi************ *@pandora.be> writes: "bazad" <no****@noreply .not> wrote in message news:1099593932 .4+jIsAHupOrTgT hYXFT72g@terane ws... Hi,
I'd like to understand consequences of Application.DoE vents call. Does it create a new thread?
Thank you
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?
"bazad" <no****@noreply .not> wrote in message
news:1099605909 .kJ+tXbnQcb3AE7 0X6mbdMw@terane ws... "Willy Denoyette [MVP]" <wi************ *@pandora.be> writes:
"bazad" <no****@noreply .not> wrote in message news:1099593932 .4+jIsAHupOrTgT hYXFT72g@terane ws... > Hi, >
Does this mean that user can click on menu items while main UI thread is busy?
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.
"Willy Denoyette [MVP]" <wi************ *@pandora.be> writes: "bazad" <no****@noreply .not> wrote in message news:1099605909 .kJ+tXbnQcb3AE7 0X6mbdMw@terane ws... "Willy Denoyette [MVP]" <wi************ *@pandora.be> writes:
"bazad" <no****@noreply .not> wrote in message news:1099593932 .4+jIsAHupOrTgT hYXFT72g@terane ws... > Hi, >
Does this mean that user can click on menu items while main UI thread is busy?
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.
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.
I disagree with Willy's answer. Application.DoE vents forces your
application to break from where it is and process all messages within the
application's message queue...message s like WM_PAINT for one. messages in
your case. After that, it returns. This will fix your problem.
ShaneB
"bazad" <no****@noreply .not> wrote in message
news:1099610547 .P7cij9OT9nkECc P+fXHq2w@terane ws... "Willy Denoyette [MVP]" <wi************ *@pandora.be> writes:
"bazad" <no****@noreply .not> wrote in message news:1099605909 .kJ+tXbnQcb3AE7 0X6mbdMw@terane ws... > "Willy Denoyette [MVP]" <wi************ *@pandora.be> writes: > >> "bazad" <no****@noreply .not> wrote in message >> news:1099593932 .4+jIsAHupOrTgT hYXFT72g@terane ws... >> > Hi, >> >
> Does this mean that user can click on menu items while main UI thread > is busy?
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.
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.
It simply forces the application to process the messages in it's message
queue before it returns. Typically, these are messages like WM_PAINT,
WM_TIMER, etc... It does not create a new thread.
ShaneB
"bazad" <no****@noreply .not> wrote in message
news:1099593932 .4+jIsAHupOrTgT hYXFT72g@terane ws... Hi,
I'd like to understand consequences of Application.DoE vents call. Does it create a new thread?
Thank you
Tell me precisely where I'm wrong.
If your UI thread is blocked waiting, it's blocked, how can a blocked
thread handle windows messages?
Willy.
"ShaneB" <st********@yah oo.com> wrote in message
news:e1******** *****@TK2MSFTNG P11.phx.gbl... I disagree with Willy's answer. Application.DoE vents forces your application to break from where it is and process all messages within the application' s message queue...message s like WM_PAINT for one. messages in your case. After that, it returns. This will fix your problem.
ShaneB
"bazad" <no****@noreply .not> wrote in message news:1099610547 .P7cij9OT9nkECc P+fXHq2w@terane ws... "Willy Denoyette [MVP]" <wi************ *@pandora.be> writes:
"bazad" <no****@noreply .not> wrote in message news:1099605909 .kJ+tXbnQcb3AE7 0X6mbdMw@terane ws... > "Willy Denoyette [MVP]" <wi************ *@pandora.be> writes: > >> "bazad" <no****@noreply .not> wrote in message >> news:1099593932 .4+jIsAHupOrTgT hYXFT72g@terane ws... >> > Hi, >> >
> Does this mean that user can click on menu items while main UI thread > is busy?
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.
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.
"bazad" <no****@noreply .not> wrote in message
news:1099610547 .P7cij9OT9nkECc P+fXHq2w@terane ws... "Willy Denoyette [MVP]" <wi************ *@pandora.be> writes:
"bazad" <no****@noreply .not> wrote in message news:1099605909 .kJ+tXbnQcb3AE7 0X6mbdMw@terane ws... > "Willy Denoyette [MVP]" <wi************ *@pandora.be> writes: > >> "bazad" <no****@noreply .not> wrote in message >> news:1099593932 .4+jIsAHupOrTgT hYXFT72g@terane ws... >> > Hi, >> >
> Does this mean that user can click on menu items while main UI thread > is busy?
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.
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.
Maybe I wasn't clear when answering your question.
As long as the UI thread runs (a loop for instance) in your handler you can
insert DoEvents calls in order to pump/dispatch messages, but if you make a
single blocking call in your handler (for instance calling a remote
procedure, a network request that takes time to return etc...) inserting
DoEvents makes no sense as the thread is blocked waiting for the call-out to
return.
But again what's your problem exactly, I suppose you did try the DoEvents
call but without success, or am I wrong?
Willy.
Willy.
He said he has a button handler that takes a while to execute. He did not
say anything about blocking the thread from executing...(su ch as a
Socket.Send call for example). I imagine what he's doing is some loop
that's taking a while and his form is not painting. Application.DoE vents
somewhere in that function will fix that.
After reading your other post a little further down, I think we're saying
the same thing.
ShaneB
"Willy Denoyette [MVP]" <wi************ *@pandora.be> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. .. Tell me precisely where I'm wrong. If your UI thread is blocked waiting, it's blocked, how can a blocked thread handle windows messages?
Willy.
"ShaneB" <st********@yah oo.com> wrote in message news:e1******** *****@TK2MSFTNG P11.phx.gbl...I disagree with Willy's answer. Application.DoE vents forces your application to break from where it is and process all messages within the application 's message queue...message s like WM_PAINT for one. messages in your case. After that, it returns. This will fix your problem.
ShaneB
"bazad" <no****@noreply .not> wrote in message news:1099610547 .P7cij9OT9nkECc P+fXHq2w@terane ws... "Willy Denoyette [MVP]" <wi************ *@pandora.be> writes:
"bazad" <no****@noreply .not> wrote in message news:1099605909 .kJ+tXbnQcb3AE7 0X6mbdMw@terane ws... > "Willy Denoyette [MVP]" <wi************ *@pandora.be> writes: > >> "bazad" <no****@noreply .not> wrote in message >> news:1099593932 .4+jIsAHupOrTgT hYXFT72g@terane ws... >> > Hi, >> >
> Does this mean that user can click on menu items while main UI thread > is busy?
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.
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.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Ollie Riches |
last post by:
I understand the use of Application.DoEvents() to process all outstanding
messages on the message queue in a winforms application if you have long
running process on the UI thread. But can anyone explain to me why I need to
call DoEvents when I am using a COM component that calls back to into the
..Net application? - If I don't call DoEvents after receiving a callback then
sometimes no more messages are pumped, it appears that the message...
|
by: bazad |
last post by:
Hi,
I'd like to understand consequences of Application.DoEvents call.
Does it create a new thread?
Thank you
|
by: Amjad |
last post by:
Hi,
Is there an equivalent to the "Application.Doevents" method in modules or
Windows services?
I want to make a Windows service that calls a DLL. The DLL would have all my
functions and it would be doing all the job, but some of the functions that
I'm using require calling something like "Application.Doevents" and I can't
use this because the DLL module is not an application.
|
by: Don |
last post by:
I have a WPF application in VB in VSTS 2008 RTM. I am trying to
"blink" (momentarily clear) a field of data if the data is reloaded
from the database to give the user some visual indication of the LOAD
operation.
So on the LOAD button I clear the text fields, do
mainCanvas.UpdateLayout( ), and the reload the text field from the
database. But the text fields are not cleared long enough to see them
blink.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |