Click here to Skip to main content
15,915,093 members
Home / Discussions / C#
   

C#

 
QuestionHow can I flush events in .Net? Pin
JoeRip28-Dec-07 10:03
JoeRip28-Dec-07 10:03 
AnswerRe: How can I flush events in .Net? Pin
Not Active28-Dec-07 10:44
mentorNot Active28-Dec-07 10:44 
GeneralRe: How can I flush events in .Net? Pin
JoeRip28-Dec-07 14:43
JoeRip28-Dec-07 14:43 
GeneralRe: How can I flush events in .Net? Pin
Luc Pattyn29-Dec-07 2:15
sitebuilderLuc Pattyn29-Dec-07 2:15 
GeneralRe: How can I flush events in .Net? Pin
JoeRip29-Dec-07 2:26
JoeRip29-Dec-07 2:26 
GeneralRe: How can I flush events in .Net? Pin
Luc Pattyn29-Dec-07 2:47
sitebuilderLuc Pattyn29-Dec-07 2:47 
GeneralRe: How can I flush events in .Net? Pin
JoeRip29-Dec-07 2:54
JoeRip29-Dec-07 2:54 
GeneralRe: How can I flush events in .Net? Pin
Mark Churchill30-Dec-07 16:08
Mark Churchill30-Dec-07 16:08 
Hrmmm I should chuck my 2c in here.

Sometimes (probably due to a less than ideal architecture) you may find a whole bunch of events in your queue. The correct behaviour here is to process the events. You may choose to fast-discard keypresses and clicks - but the decision to flush the queue may cause your application to lose critical information. You could lose network connectivity change notifications, system shutdown notifications...

Particularily if you are intending to have your application run on Vista - which is very very quick to detect applications not pumping their message queue, and very quick to suggest they are hanging and should be closed.

So I don't think it was "overly simplistic and incorrect". It was good advice, on par with "do not call GC.Collect()". Sure - you could think up a scenario where it might be useful - but in 99% of cases you should just do it right.

If you need to flush your message queue then use PInvoke to call the API function. If the framework supports this it will be in the Application or Form class. It probably doesnt, because its bad practice. HTH


GeneralRe: How can I flush events in .Net? Pin
JoeRip30-Dec-07 19:41
JoeRip30-Dec-07 19:41 
QuestionAny query???? Pin
omegazafer28-Dec-07 10:02
omegazafer28-Dec-07 10:02 
AnswerRe: Any query???? [modified] Pin
GuyThiebaut28-Dec-07 10:20
professionalGuyThiebaut28-Dec-07 10:20 
GeneralRe: Any query???? Pin
omegazafer28-Dec-07 11:10
omegazafer28-Dec-07 11:10 
GeneralRe: Any query???? Pin
GuyThiebaut28-Dec-07 11:18
professionalGuyThiebaut28-Dec-07 11:18 
GeneralRe: Any query???? Pin
omegazafer28-Dec-07 11:32
omegazafer28-Dec-07 11:32 
GeneralAccessing folder from outlook express 2003 with C# 1.1 Pin
Het210928-Dec-07 8:19
Het210928-Dec-07 8:19 
GeneralRe: Accessing folder from outlook express 2003 with C# 1.1 Pin
KaptinKrunch28-Dec-07 8:59
KaptinKrunch28-Dec-07 8:59 
GeneralRe: Accessing folder from outlook express 2003 with C# 1.1 Pin
Het210928-Dec-07 9:05
Het210928-Dec-07 9:05 
GeneralRe: Accessing folder from outlook express 2003 with C# 1.1 Pin
KaptinKrunch28-Dec-07 9:15
KaptinKrunch28-Dec-07 9:15 
GeneralRe: Accessing folder from outlook express 2003 with C# 1.1 Pin
Het210928-Dec-07 9:28
Het210928-Dec-07 9:28 
GeneralRe: Accessing folder from outlook express 2003 with C# 1.1 Pin
KaptinKrunch28-Dec-07 9:38
KaptinKrunch28-Dec-07 9:38 
GeneralRe: Accessing folder from outlook express 2003 with C# 1.1 Pin
Het210928-Dec-07 9:41
Het210928-Dec-07 9:41 
GeneralRe: Accessing folder from outlook express 2003 with C# 1.1 Pin
KaptinKrunch28-Dec-07 10:07
KaptinKrunch28-Dec-07 10:07 
GeneralRe: Accessing folder from outlook express 2003 with C# 1.1 Pin
Het210928-Dec-07 10:31
Het210928-Dec-07 10:31 
GeneralCheckbox should delete any childnode but not the root node. Can someone please help?? [modified] Pin
T4AMD28-Dec-07 8:18
T4AMD28-Dec-07 8:18 
GeneralRe: Checkbox should delete any childnode but not the root node. Can someone please help?? Pin
KaptinKrunch28-Dec-07 8:36
KaptinKrunch28-Dec-07 8:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.