|
This console app:
[STAThread]
static void Main(string[] args)
{
using (FileStream fs = new FileStream(@"c:\output.txt", FileMode.Create, FileAccess.Write))
{
using (TextWriter t = new StreamWriter(fs))
{
t.WriteLine("0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789");
}
}
}
writes out 100 characters no problem.
Regards,
Rob Philpott.
|
|
|
|
|
I'll bet my car keys you're not flushing the stream...
Regards,
Rob Philpott.
|
|
|
|
|
You are right it works! Thanks
|
|
|
|
|
Hi all,
I'm using a picturebox to display the images relaid from a Canon camara, and I have the following problem...
Each frame captured by the camara is dispayed within the picturebox. And when I try and use the Selection Control[^], I receive the following exception: Object is currently in use elsewhere.
Because of the following function (this function fires everytime a frame is received and thats about every couple of milliseconds):
void camera_ReceivedFrame(object sender, StreamEventArgs e)
{
comEnPiBox1.SourceImage = e.frame;
pictureBox1.Image = comEnPiBox1.SelectArea;
}
Any advice regarding this matter....
Many Thanks in advance
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
modified on Friday, March 14, 2008 6:09 AM
|
|
|
|
|
Sounds like a threading issue. Try using the lock statement. More info here[^]
|
|
|
|
|
Hi,
Thanks for the reply, but if I use a lock on the picturebox and give exclusive right to the camara input, I will never be able to give the user seletion options on the picturebox. Cause the camara's frames are captured every couple of milli seconds.
You don't perhaps know of a control were a user can make a selection on a picturebox, while an input from a camara is refreshing the image within the picturebox?
Many thanks
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Hi.
Well you don't have to use a lock statement on the picturebox itself: you can use a specially assigned locker object for that (there's more about it in the article I linked to in the previous post). The same goes for having a user make settings: You can have the user make any setting outside of the lock, shortly acquire it to apply the changed settings and then release it for your camera.
I have to say I really don't think the PictureBox control was meant for this kind of usage though. I'd look for a different approach, perhaps using DirectShow.
Hope this helps, cheers.
Standards are great! Everybody should have one!
|
|
|
|
|
Thanks for the reply and the information
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Hi all
I have done some reports with help of crystal report in asp.net,C#(2.0).
Its running fine local but while uploading them on server ,its unable
to show page.
how can I resolve this problem?
Amitava
|
|
|
|
|
Hi,
Kindly help me that, How may I change TCP/IP setting using C# coding?
Lot of Thankx in Advance
(Riaz)
|
|
|
|
|
|
Hi,
Could you compile it then run it in debug mode and post the error message please.
Guy
You always pass failure on the way to success.
|
|
|
|
|
GuyThiebaut wrote: Could you compile it then run it in debug mode and post the error message please.
Sorry if I caused a misunderstanding, but there is no error message nor error, it's just that, while the camera is being initialized in the delegates the screen hangs until the initialization has finished ...
Any suggestions ?
Thanks for the reply
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Have you tried threading the initialisation process?
Use the background worker to initialise the camera and once it has been initialised make it available though your app.
You always pass failure on the way to success.
|
|
|
|
|
GuyThiebaut wrote: Use the background worker to initialise the camera and once it has been initialised make it available though your app.
No I haven't ... not even sure how to do something like that
Thanks for the reply
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Just been in a meeting so did not have time to post this clickety
You always pass failure on the way to success.
|
|
|
|
|
Try BeginInvoke() for asynchronous execution of the delegate.
|
|
|
|
|
Hi,
Thanks for the reply ... But it doesn't make a difference
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
I had a second look at your code snippet. I guess that this (on which you call Invoke) ist your control. You may try to call BeginInvoke on the delegate itself.
|
|
|
|
|
I just wat to add that the function that is accosiated with the delegate is updating controls on the form. Will this xcause the problem?
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Yes, since you need to do any updates to the UI from the thread they were created on (this would usually be the main thread in your program). I suggest using a BackgroundWorker[^]. You can assign it to do all non UI related work in DoWork and then use ReportProgress and RunWorkerCompleted to update your UI in a thread safe way.
Standards are great! Everybody should have one!
|
|
|
|
|
|
Programm3r,
Just on a side note, you don't need to declare two delegates. Only one. Since a delegate is determined by the params its passed.
Just thought i'd tell you that so it saves you time in the future if you need to use a lot of delegates. I hope you understand, if not, say so and i'll find a URL that explains it better.
Regards,
Gareth.
|
|
|
|
|
Hi Everybody,
I have an application, in which many parameters has to be combined and it has to be encrypted and then it has to be resized to a smaller text and the it has to be stored and in future this has to be expanded and I have to decrypt and restore the same parameters.
Can any one help in this regard?
Thanks a lot in advance.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
Chain some streams together. You want to write your data to a compression stream and feed that to an encryption stream.
Going the other way read from a decryption stream to a decompression stream to a normal stream.
This http://support.microsoft.com/kb/307010[^] tells you about encryption streams.
Off the top of my head I believe there is a compression stream somewhere in .NET2.0. If not the free assembly ICSharpZipLib has what you need.
Regards,
Rob Philpott.
|
|
|
|