Click here to Skip to main content
15,895,667 members
Home / Discussions / C#
   

C#

 
QuestionMemory leak Pin
HexaDeveloper4-Apr-07 5:11
HexaDeveloper4-Apr-07 5:11 
AnswerRe: Memory leak Pin
Russell Jones4-Apr-07 6:06
Russell Jones4-Apr-07 6:06 
GeneralRe: Memory leak Pin
HexaDeveloper4-Apr-07 7:44
HexaDeveloper4-Apr-07 7:44 
GeneralRe: Memory leak Pin
Luc Pattyn4-Apr-07 11:06
sitebuilderLuc Pattyn4-Apr-07 11:06 
GeneralRe: Memory leak Pin
HexaDeveloper8-Apr-07 5:49
HexaDeveloper8-Apr-07 5:49 
GeneralRe: Memory leak Pin
Luc Pattyn8-Apr-07 6:37
sitebuilderLuc Pattyn8-Apr-07 6:37 
GeneralRe: Memory leak Pin
HexaDeveloper8-Apr-07 6:49
HexaDeveloper8-Apr-07 6:49 
GeneralRe: Memory leak Pin
Luc Pattyn8-Apr-07 7:08
sitebuilderLuc Pattyn8-Apr-07 7:08 
Hi,

I did not understand very much of what you wrote.
It seems like you want some animation to start when a "Start" button is pressed,
and stopped when a "Stop" button is pressed, and furthermore the "Stop" button does
not (always) work reliably.

There can be several causes for this:
- you might be doing too much stuff in the UI thread
- CPU load might be high at or above the priority of the UI thread
- some logical error in the communication bewteen the "Stop" button handler,
and the thread that does the animation.

Maybe this info will help:

methods are executed on the same thread as the code that calls them (unless you
do very special things, such as calling Invoke). Some asynchronous stuff is executed
on another method automatically (e.g. a tick handler for all timers, except a
Windows.Forms.Timer).

if you try to modify the user interface (i.e. add/remove/modify a Control) from
a thread other than the UI thread (the one you have at start) then:
- under .NET 1.1 your program may freeze, or behave unpredictably
- under .NET 2.0/3.0 you will get some "CrossThread" Exception (you could set some
flag false to skip the checks, but then the app may freeze again).

You may want to create your own background thread, so you can fully control it
(set priority, kill/abort it, etc).

You may want to find and read an MSDN article entitled
"How to: Use a Background Thread to Search for Files "
which probably explains more on InvokeRequired, Invoke, threads, etc.

Smile | :)




Luc Pattyn

[My Articles]

GeneralRe: Memory leak Pin
HexaDeveloper8-Apr-07 7:12
HexaDeveloper8-Apr-07 7:12 
GeneralRe: Memory leak [modified] Pin
Luc Pattyn8-Apr-07 11:21
sitebuilderLuc Pattyn8-Apr-07 11:21 
GeneralRe: Memory leak Pin
HexaDeveloper8-Apr-07 12:43
HexaDeveloper8-Apr-07 12:43 
GeneralRe: Memory leak Pin
Luc Pattyn8-Apr-07 13:05
sitebuilderLuc Pattyn8-Apr-07 13:05 
QuestionGet Controls by name Pin
swjam4-Apr-07 5:03
swjam4-Apr-07 5:03 
AnswerRe: Get Controls by name Pin
B.King4-Apr-07 5:50
B.King4-Apr-07 5:50 
QuestionHow to specify an event handler Pin
peterchen4-Apr-07 5:02
peterchen4-Apr-07 5:02 
AnswerRe: How to specify an event handler Pin
mikanu4-Apr-07 6:48
mikanu4-Apr-07 6:48 
QuestionMulti-select ComboBox Pin
Amatista4-Apr-07 4:46
Amatista4-Apr-07 4:46 
AnswerRe: Multi-select ComboBox Pin
Douglas Troy4-Apr-07 6:00
Douglas Troy4-Apr-07 6:00 
GeneralRe: Multi-select ComboBox Pin
Amatista4-Apr-07 22:27
Amatista4-Apr-07 22:27 
GeneralRe: Multi-select ComboBox Pin
Douglas Troy5-Apr-07 5:34
Douglas Troy5-Apr-07 5:34 
GeneralRe: Multi-select ComboBox Pin
Amatista10-Apr-07 2:27
Amatista10-Apr-07 2:27 
QuestionControl Draw delay on resize (Getting rid of it) Pin
Muntyness4-Apr-07 3:11
Muntyness4-Apr-07 3:11 
AnswerRe: Control Draw delay on resize (Getting rid of it) Pin
Stanciu Vlad4-Apr-07 7:52
Stanciu Vlad4-Apr-07 7:52 
QuestionMSI uninstall problems Pin
Vadim G.4-Apr-07 2:53
Vadim G.4-Apr-07 2:53 
AnswerRe: MSI uninstall problems Pin
Douglas Troy4-Apr-07 3:51
Douglas Troy4-Apr-07 3:51 

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.