Click here to Skip to main content
15,923,083 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
QuestionInterop call in .Net exe fails when executing from Scheduled task Pin
Hariharan.T5-Jul-09 23:22
Hariharan.T5-Jul-09 23:22 
AnswerRe: Interop call in .Net exe fails when executing from Scheduled task Pin
Colin Angus Mackay6-Jul-09 1:57
Colin Angus Mackay6-Jul-09 1:57 
QuestionFramework and Flatform? Pin
hkim_zoro5-Jul-09 17:48
hkim_zoro5-Jul-09 17:48 
AnswerRe: Framework and Flatform? Pin
Colin Angus Mackay6-Jul-09 1:58
Colin Angus Mackay6-Jul-09 1:58 
GeneralRe: Framework and Flatform? Pin
hkim_zoro7-Jul-09 16:23
hkim_zoro7-Jul-09 16:23 
QuestionBest practice for updating UI in multi-threaded app Pin
bobishkindaguy5-Jul-09 13:55
bobishkindaguy5-Jul-09 13:55 
AnswerRe: Best practice for updating UI in multi-threaded app Pin
Gideon Engelberth5-Jul-09 16:03
Gideon Engelberth5-Jul-09 16:03 
AnswerRe: Best practice for updating UI in multi-threaded app Pin
supercat96-Jul-09 13:13
supercat96-Jul-09 13:13 
There is a world of difference between performing BeginInvoke on a delegate, and performing it on a control (passing a delegate as a parameter). IMHO, using the same name for both methods was a mistake, but what's done is done.

Performing BeginInvoke on a control will not create a new thread, nor take one from the thread pool, but will instead post a message in the control's UI thread's event queue. There is no particular limit to the number of messages that can be posted in the event queue, but one should nonetheless limit the number of unprocessed messages one will post to the event queue. Otherwise, if the UI thread gets blocked for some reason, such messages may accumulate without bound.

My particular coding style is to use an UpdateNeeded variable (declared as Integer, but functionally a Boolean) which is set to 0 at the beginning of the control's update routine. When I'm considering updating a control, I Threading.Interlocked.Exchange the variable to 1 and see if it wasn't already 1. If so, I perform a BeginInvoke on the control. If the BeginInvoke fails, I set the variable to 2 (so the control's update routine will know that the control needs updating, but other attempts to update the control will retry the BeginInvoke).

This style assumes that (1) if there are many changes to a control's value before an update takes place, all but the last should be ignored; (2) it is acceptable to update the fields associated with a control while it's being drawn, provided that one performs another update after the current one completes; (3) a redundant control update (e.g. because a field was changed after the update routine started to draw a control, but before the field's value was sampled) will be harmless; (4) updating controls every time the value changes will not cause excessive CPU loading.

If these assumptions hold, the code is fairly straightforward. If they do not, things are more complicated.
QuestionRe: Best practice for updating UI in multi-threaded app Pin
bobishkindaguy6-Jul-09 13:32
bobishkindaguy6-Jul-09 13:32 
AnswerRe: Best practice for updating UI in multi-threaded app Pin
supercat97-Jul-09 5:27
supercat97-Jul-09 5:27 
QuestionRe: Best practice for updating UI in multi-threaded app Pin
bobishkindaguy8-Jul-09 12:51
bobishkindaguy8-Jul-09 12:51 
AnswerRe: Best practice for updating UI in multi-threaded app Pin
supercat98-Jul-09 13:01
supercat98-Jul-09 13:01 
QuestionHow to get http request?? Pin
david bagaturia5-Jul-09 9:21
david bagaturia5-Jul-09 9:21 
AnswerRe: How to get http request?? Pin
Mark Salsbery6-Jul-09 10:05
Mark Salsbery6-Jul-09 10:05 
GeneralRe: How to get http request?? Pin
david bagaturia6-Jul-09 10:35
david bagaturia6-Jul-09 10:35 
GeneralRe: How to get http request?? Pin
0x3c06-Jul-09 10:41
0x3c06-Jul-09 10:41 
QuestionTroy's looking Pin
Troy Russell5-Jul-09 6:28
Troy Russell5-Jul-09 6:28 
QuestionHelp needed in decryption with TripleDes method Pin
ChiSmile5-Jul-09 2:47
ChiSmile5-Jul-09 2:47 
AnswerRe: Help needed in decryption with TripleDes method Pin
Alan N5-Jul-09 3:24
Alan N5-Jul-09 3:24 
GeneralRe: Help needed in decryption with TripleDes method Pin
ChiSmile5-Jul-09 4:58
ChiSmile5-Jul-09 4:58 
GeneralRe: Help needed in decryption with TripleDes method Pin
Henry Minute5-Jul-09 5:53
Henry Minute5-Jul-09 5:53 
GeneralRe: Help needed in decryption with TripleDes method Pin
ChiSmile5-Jul-09 15:08
ChiSmile5-Jul-09 15:08 
QuestionHow to Display ads on .Net form? Pin
slimtugo4-Jul-09 23:50
slimtugo4-Jul-09 23:50 
AnswerRe: How to Display ads on .Net form? Pin
Eddy Vluggen4-Jul-09 23:58
professionalEddy Vluggen4-Jul-09 23:58 
QuestionRe: How to Display ads on .Net form? Pin
slimtugo7-Jul-09 8:01
slimtugo7-Jul-09 8:01 

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.