|
Now I understood!
It Seems to work!!!
This is the magic solution!!!!
Luc Pattyn, thanks!
Thank you very much for all your help!!!
|
|
|
|
|
you're welcome.
|
|
|
|
|
|
Figured out, that if a native win32 console application
didn`t fflush its stdout and stderr,
redirecting its output is a real problem!
Is it possible to redirect 'bad' console apps,
(without fflush(stdout))?
Also found solution, by _Olivier_, but I don`t want to use
any stubs an 'between stuff'!
Real-Time Console Output Redirection[^]
Thank you all, for your help!
|
|
|
|
|
public class MyTextBox : TextBox
{
private static Dictionary<IntPtr, WeakReference> mList = new Dictionary<IntPtr, WeakReference>();
public MyTextBox()
{
mList.Add(Handle, new WeakReference(this));
}
}
Any problem for MyTextBox being garbage collected?
|
|
|
|
|
I recommend that you google ".net weak references". You'll get over 6.8 million results back, and there appear to be a number of good links on the first page of results.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
If nothing has a strong reference to MyTextBox, then yeah, it could get GC'ed. Thats why its called a WeakReference. Why would you use a WeakReference here anyways?
|
|
|
|
|
Making it weak reference will not prevent GC to play it's role. It's static. If it's not weak reference strong references of hundreds of textboxes in my app get polluted. I just bother with the textboxes that are really alive.
|
|
|
|
|
If you're relying on the reference being there, then you either need something that can recreate the reference when needed, or you need to maintain a strong reference.
|
|
|
|
|
I just bother with the textboxes that are really alive.
|
|
|
|
|
Objects of type MyTextBox will be collected if there are no strong references to them and, of course, the GC performs a garbage collection. mList dictionary will not be collected becouse there is a static strong reference to it, unless you clear this reference. I guess you have a static method or property to access the contents of mList Dictionary, becouse if you don't this dictionary is completely useless, and I don't see how you should need it unless MyTextBox class was much more heavy than it seems to be.
|
|
|
|
|
thomus07 wrote: private static Dictionary<intptr, weakreference="">
What do you think is going to happen with that IntPtr when the GC collects the TextBox?
|
|
|
|
|
How to extract any object from the image after convert it's to black and white.
|
|
|
|
|
If the image is of a top hat I might be able to extract a rabbit from it, otherwise it beyond my abilities.
|
|
|
|
|
Boom tish!
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
a
Ramkumar
("When you build bridges you can keep crossing them. ")
http://ramkumarishere.blogspot.com
|
|
|
|
|
Ramkumar_S wrote: a
aa
|
|
|
|
|
|
Were you proposing to post a reply, with each letter in a separate message?
If so, this could take a while...
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
|
|
|
|
|
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
My latest tip/trick
|
|
|
|
|
So you think being abrupt and rude will get you an answer? Good luck with that.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
What is the difference between an orange?
|
|
|
|
|
DAMN YOU! You beat me to it! (But I still have to give you a 5.)
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass." - Dale Earnhardt, 1997
|
|
|
|
|
what's the color of an orange on a black & white image?
|
|
|
|
|
How many bits ?
|
|
|
|