|
This text 'ReadToEnd assumes that the stream knows when it has reached an end. For interactive protocols, in which the server sends data only when you ask for it and does not close the connection, ReadToEnd might block indefinitely and should be avoided.' was taken from MSDN link here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfSystemIOStreamReaderClassReadToEndTopic.asp[^] it seems like your program is waiting on a termination.
I am not 100% on your code, i know your trying to redirect the response or messages through your program but what if there are none? Maybe you should run the command and have a listener on a seperate thread.
Darren
|
|
|
|
|
So am understanding you correctly,
the program is waiting for the comand prompt to close but it's stuck trying to sen me an output?
He who laughs last...
|
|
|
|
|
i found the problem...
The part where i say:
startInfo.Arguments = Convert.ToString(command);
it gets sent to the command prompt but its not seen as a command and thus does not create an output for me and is stuck waiting.
it should be
startInfo.Arguments ="/C " + Convert.ToString(command);
This switch is for when you send a command.
thank you for putting me in the right direction.
He who laughs last...
|
|
|
|
|
Excellent, glad you fixed it
|
|
|
|
|
What means "Apartment" in C#?
|
|
|
|
|
|
Hi All,
I wanted to know whether there is some technique to find out if a file is being written or not. Means suppose a WAV file is being recorded and i have applied a FileWatcher to the same directory in which this WAV file is created. So now i want to know when the WAV file completes its recording. When it completes it recording i want to copy it to some other directory.
So is there any event or some other technique which can be applied to know this. I had some logic like, i will try to write to the file and if an exception occurs i wont copy it, but the problem is that this is not a good programming practice and what if the file has completed recording, I would corrupt that file in this case. Seems foolish, thats why i didnt cotinued with it.
If some one has some idea about my problem please post reply !
Thanks !
"A good programmer is someone who looks both ways before crossing a one-way street." -- Doug Linder
Anant Y. Kulkarni
|
|
|
|
|
Instead of trying to write to the file, try reading it. It will fail if there is still a write lock on the file.
|
|
|
|
|
You could read the file attribute 'size' periodically until the size stops increasing.
Or if said process that creates the .wav terminates when it is complete you could monitor running processes on the machine until the wav writing process finishes.
alternativly this article: http://www.thecodeproject.com/csharp/tail.asp[^] mentions 'The most notable piece from below is the way that the FileStream is created to read files that may be open by other processes.' Edit: not sure if i read that right, i think its more a way around reading something taht is already open.
Darren
-- modified at 2:37 Tuesday 30th May, 2006
|
|
|
|
|
I have some source code of html pages , I stored them into a DB (access)
there are some links into their source code, i load them with web browser,(they are linked together ). so how i can manage their links?
|
|
|
|
|
React to the navigate event fired when the user clicks a link. You can then cancel the navigation and update the source yourself.
|
|
|
|
|
can you please explain it in details?
how can i handle these events when there are more than one link in the html page?
thanks
|
|
|
|
|
It is all in MSDN - look up the WebBrowser control (obviously).
The event is called "Navigating" as far as I can see.
It will fire for each click on a link. In the event handler do the following:
1) Cancel the navigation (a property or method on the event args)
2) Look at the target URL (it is in the event args) to find out which page the user requested
3) Fetch the HTML for that page from your DB
4) Set the HTML of the WebBrowser control to the new content
Notice that you will probably (can't remember it for sure) get an initial "Navigating" event fired when you initialize the WebBrowser control. Make sure you leave this alone (do not cancel it). Use the debugger to see if you get something like this, and how the URL looks so you can avoid canceling.
Obviously this is for .NET 2.0 - I can't remember how to do this (or if it is possible at all) with the horrible COM generated wrapper for the web browser in 1.1.
|
|
|
|
|
thanks in advance
but im working on VS2003.
could u help me for another problem??
i use follow functions for loadind my html pages,there are some pictures in my source code of html page , that have relative src ,
when the browser navigate , the pictures didn't show!!!
what can i do??
private void Form2_Load(object sender, System.EventArgs e)
{
object empty = System.Reflection.Missing.Value;
axWebBrowser1.Navigate("about:blank", ref empty, ref empty, ref empty, ref empty);
}
public void html_load(string context,string title)
{
string SourceCode="";
SourceCode="" + context+ "";
// create an IHTMLDocument2
mshtml.IHTMLDocument2 doc = axWebBrowser1.Document as mshtml.IHTMLDocument2;
// write to the doc
doc.clear();
doc.writeln(SourceCode);
doc.close();
}
|
|
|
|
|
I think the same event is available in the COM wrapper used in the old versions of .NET, but then you are on your own. Read the documentation.
For the images you might want to write the HTML and images to disk (temp directory or something) and load from there - then the relative path match.
|
|
|
|
|
Dear All,
Please send me the MCP QUESTION FOR C#
I m very interested to write a MCP exam for C#.
With GreatRegards,
Shiv
|
|
|
|
|
|
Shiv5 wrote: Please send me the MCP QUESTION FOR C#
Learn the damn stuff yourself - I worked hard for my certification and I will not have it devalued by a bunch of lazy idiots that don't want to spend the time learning the required course material.
"On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question."
--Charles Babbage (1791-1871)
My: Website | Blog
|
|
|
|
|
Dude I recomand you to learn books by urself cuz it;s the best way to understand programming........
|
|
|
|
|
Hi guys,
I am currently writing a small app that contains an editable ListView based on the one detailed here:
http://www.c-sharpcorner.com/Code/2002/July/EditableListView.asp
I noticed a small bug in the code in case your interested, to correctly work out the column to edit from the x,y values of your mouse the code totals up the column widths to find an x value that matches entry of the bounds for the editable box your mouse clicked in. However, the first column width is already checked before it continues, when it continues it adds the first column width again before checking and therefore messes up if you have different column widths, so the line:
epos += this.Columns[i].Width;
simply needs changed to:
epos += this.Columns[i+1].Width;
Anyway, I have a small problem that has been bugging me for hours now and hope you can help. If the said ListView or any form control for that matter is larger than the size of the form, a scrollbar appears. Therefore when the user clicks on the screen you recieve the x,y coordinates from the top left of the form or part of the control that is visable (not sure myself) so.. is there a way to get the scrollbar offset so you can correctly determine the x,y coordinates even though a portion of the control is not visible?
Any help would be great and thanks for your time
Darren
|
|
|
|
|
Dear All,
How do i read and Execute a bunch of .Sql at the same time using C#
Send me sample code for that
GreatRegards,
Sivakumar Lakshmanan.
|
|
|
|
|
I am not sure what exactly you are trying to do with the .Sql but may I suggest that you look at the Database Application Block from Microsoft. The Application Block abstracts much of the database work into a series of static methods that are very useful.
Not withstanding the application block I would suggest that you explore the Data namespace and use the SqlCommand object. You will have to set the commandtext then execute the command. As a side note I would strongly suggest that you use stored procedures if you have a "bunch" of scripts to run.
Hope it helps
|
|
|
|
|
Hi All!
Could some one help me how to add a control on menu bar?
It looks like Microsoft Word, it has a combo box in top right corner.
Thanks
|
|
|
|
|
if you are using Visual Studio 2005 then you can simply insert a menustrip which allows you to include a combo box on the menustrip itself.
|
|
|
|
|
I'm working on a bible project. Part of it is to display bible verses on screen. Given that the bible text are in different formats (some are italics, some are in red, ...).
I tried using labels to display them. But if one chapter has 80 verses, I would have to create at least 80 labels. This is very slow - could take 15-20 seconds to display.
Apart from using labels, is there any other efficient way to handle text display?
Thanks!!
|
|
|
|