Click here to Skip to main content
15,922,894 members
Home / Discussions / C#
   

C#

 
GeneralERROR Pin
superda27-Dec-07 18:21
superda27-Dec-07 18:21 
GeneralRe: ERROR Pin
N a v a n e e t h27-Dec-07 20:09
N a v a n e e t h27-Dec-07 20:09 
GeneralRe: ERROR Pin
superda27-Dec-07 20:36
superda27-Dec-07 20:36 
GeneralRe: ERROR Pin
m@u27-Dec-07 21:23
m@u27-Dec-07 21:23 
GeneralRe: ERROR Pin
superda27-Dec-07 22:11
superda27-Dec-07 22:11 
GeneralRe: ERROR Pin
m@u27-Dec-07 22:41
m@u27-Dec-07 22:41 
GeneralRe: ERROR Pin
Paul Conrad28-Dec-07 10:19
professionalPaul Conrad28-Dec-07 10:19 
QuestionHow can I flush events for a form? Pin
JoeRip27-Dec-07 17:50
JoeRip27-Dec-07 17:50 
I'm looking for something like the old Windows API FlushEvents().

I have a form which creates a COM object like such:

COMServerObject foo = new COMServerObject;<br />

While my code waits for this statement to return, Windows makes my form window modal. If it takes a while for this statement to return - up to 20 seconds for .NET to give up and throw an exception - Windows queues up mouse clicks and keyboard events on my form, and then plays them back once the statement returns.

This is nasty, as the user hammers away at my unresponsive window, even trying to close it. So once the statement returns, my window can suddenly fly around the screen, resize, minimize, and even close.

I've tried disabling the Form while while I wait:

this.Text = "Hey, wait!";<br />
this.Enabled = false;<br />
COMServerObject foo = new COMServerObject;<br />
this.Enabled = true;<br />
this.Text = "Hey, thanks for waiting."


And this prevents clicks on my various buttons and menus. However, it does NOT prevent clicks on the window frame or title bar or close controls, so they still get queued up.

How can I prevent these from queuing? In the old Windows API, you could call FlushEvents when you got back from a modal state, which would remove all Windows events from it's message queue. I can't find anything analogous in the .Net framework. Anybody know the proper technique, here?
AnswerRe: How can I flush events for a form? Pin
KaptinKrunch28-Dec-07 3:39
KaptinKrunch28-Dec-07 3:39 
GeneralRe: How can I flush events for a form? Pin
JoeRip28-Dec-07 9:57
JoeRip28-Dec-07 9:57 
QuestionHow to access cookie values in a single domain? Pin
Reena.E27-Dec-07 17:30
Reena.E27-Dec-07 17:30 
AnswerRe: How to access cookie values in a single domain? Pin
Paul Conrad28-Dec-07 10:20
professionalPaul Conrad28-Dec-07 10:20 
GeneralByte to hex string conversion Pin
piyush123027-Dec-07 17:27
piyush123027-Dec-07 17:27 
GeneralRe: Byte to hex string conversion Pin
Scott Dorman27-Dec-07 18:15
professionalScott Dorman27-Dec-07 18:15 
GeneralRe: Byte to hex string conversion Pin
Colin Angus Mackay28-Dec-07 0:12
Colin Angus Mackay28-Dec-07 0:12 
GeneralRe: Byte to hex string conversion Pin
piyush123028-Dec-07 3:37
piyush123028-Dec-07 3:37 
GeneralRe: Byte to hex string conversion Pin
Luc Pattyn28-Dec-07 4:25
sitebuilderLuc Pattyn28-Dec-07 4:25 
General[Message Deleted] Pin
Aparna.B27-Dec-07 17:11
Aparna.B27-Dec-07 17:11 
GeneralRe: FTP Pin
KaptinKrunch28-Dec-07 3:41
KaptinKrunch28-Dec-07 3:41 
GeneralDateTime Format Pin
eggie527-Dec-07 16:42
eggie527-Dec-07 16:42 
GeneralRe: DateTime Format Pin
JoeRip27-Dec-07 17:55
JoeRip27-Dec-07 17:55 
GeneralRe: DateTime Format [modified] Pin
JoeRip27-Dec-07 18:00
JoeRip27-Dec-07 18:00 
GeneralRe: DateTime Format Pin
Xmen Real 27-Dec-07 22:19
professional Xmen Real 27-Dec-07 22:19 
GeneralRe: DateTime Format Pin
PIEBALDconsult28-Dec-07 13:38
mvePIEBALDconsult28-Dec-07 13:38 
GeneralRe: DateTime Format Pin
eggie528-Dec-07 13:44
eggie528-Dec-07 13:44 

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.