|
Hi
Why did you give the wait for exit time as 10000 i.e WordProcess.WaitForExit(10000);
if you want the first application to be closed and open the second one do like this
WordProcess.WaitForExit();// wait for infinite
System.Diagnostics.Process.Start(txt_websiteAddress.Text);
And about HasExited property, if any of the word document is open other than the closed document, this property will not get updated. Since Word is single process which launch different instance of editor.
Thanks
Srini
|
|
|
|
|
Hi!
I just tried this and it works as expected using this code:
ProcessStartInfo psi = new ProcessStartInfo("C:\\Document.doc");
MessageBox.Show("Starting...");
Process p = Process.Start(psi);
p.WaitForExit();
MessageBox.Show("Finished");
The second message box appears as soon as I close Word.
Does this help?
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
|
Ok, I don't want to be one of those jerks who finds the answer and doesn't share so I have the working code here. I don't know why this didn't work before, but it didn't, and now it does, so I'm happy.
System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo();<br />
psi.RedirectStandardOutput = true;<br />
psi.WindowStyle = System.Diagnostics.ProcessWindowStyle.Maximized;<br />
psi.UseShellExecute = false;<br />
psi.Arguments = txt_Wordfile.Text + " /n";<br />
psi.FileName = WordExe;
<br />
System.Diagnostics.Process WordProcess = new System.Diagnostics.Process();<br />
<br />
WordProcess = System.Diagnostics.Process.Start(psi);<br />
<br />
WordProcess.EnableRaisingEvents = true;<br />
while (!WordProcess.HasExited)<br />
{<br />
;<br />
}<br />
WordProcess.Kill(); <br />
<br />
<br />
System.Diagnostics.Process.Start(txt_website.Text);
Thanks everyone for your help!
|
|
|
|
|
Hello,
Just an addintional info.
As the Process class implements IDisposable you should call Dispose() to free the memory.
You could use an using-block for that reason.
using(System.Diagnostics.Process WordProcess = new System.Diagnostics.Process())
{
WordProcess = System.Diagnostics.Process.Start(psi);
...
}
I don't think there is a need to call the "Kill" method after "HasExited" is "true".
Same with "EnableRaisingEvents", only needed if you want to handle the "Exited" event.
P.S.: Strange, that WaitForExit is not working here.
All the best,
Martin
|
|
|
|
|
Hey Guys,
I am developing a simple windows mobile gps app. I have a MC35 device which has a build in GPS on port COM0.
I am having trouble accessing that port to get the GPS data.
My code looks like this
SerialPort port = new SerialPort("COM0", 9600, Parity.None, 8, StopBits.One);
port.Open();
I get an IO Exception at the port.Open();
No other application is using this port.
When I go into Google Map GPS works fine.
|
|
|
|
|
Simerjots,
Paste the IO Exception here...
Regards,
Gareth.
|
|
|
|
|
Thanks for the reply Gareth.
All the Exception say is IOException.
Also no details avaible.
|
|
|
|
|
at System.IO.Ports.SerialStream.WinIOError(Int32 errorCode, String str)
at System.IO.Ports.SerialStream..ctor(String portName, Int32 baudRate, Parity parity, Int32 dataBits, StopBits stopBits, Int32 readTimeout, Int32 writeTimeout, Handshake handshake, Boolean dtrEnable, Boolean rtsEnable, Boolean discardNull, Byte parityReplace)
at System.IO.Ports.SerialPort.Open()
at SmartDeviceProject2.Form1.SendSampleData()
at SmartDeviceProject2.Form1..ctor()
at SmartDeviceProject2.Program.Main()
|
|
|
|
|
|
Please delete this idiot from the site. It's gotten beyond annoying at this point.
|
|
|
|
|
hey..... what do you want, i saw all your messages, its like irritating, please dont spoil the name of your home country and people. try to be polite in asking question as well in answering question.
Srini
|
|
|
|
|
I'm wondering how to implement an auto-upgrading system for a windows mobile (C# .NET 2.0) application that works as well as ClickOnce or something similar. The app would communicate to a web service to get patch info and the actual files as well.
Does anybody know of an article that explains how to impliment an upgrade system for a mobile application?
I've read a few articles on transfering files over a web service, so that's as much of a hurdle.
|
|
|
|
|
|
JGentsch wrote: Does anybody know of an article that explains how to impliment an upgrade system for a mobile application?
Do you know about the Microsoft Patterns and Practices site[^]? It used to have a Application Updater[^] block but they have reorganized the site and the only way I can find it know is with Google. Apparently they they believe Updating Application over the network is "old news".
The patterns & practices team has decided to archive this content to allow us to streamline our latest content offerings on our main site and keep it focused on the newest, most relevant content. However, we will continue to make this content available because it is still of interest to some of our users.
led mike
|
|
|
|
|
Hi,
I just wanna know if theres a "template " control or something in VS2005. otherwise i will write an xml to change the form color. forecolor etc. I want the user to be able to change the colors from xml. I think i can do it using hex color codes.Any ideas ?
|
|
|
|
|
I have no idea what you are talking about but perhaps you are interested in the XML Configuration file support in the .NET Base Class Library which can be found in the System.Configuration namespace
led mike
|
|
|
|
|
I want to give access to users to be able to change the label.forecolor, textcolor, etc through an xml file. I was wondering if theres another way of doing it or not?
|
|
|
|
|
s3rro wrote: I want to give access to users to be able to change the label.forecolor, textcolor, etc through an xml file. I was wondering if theres another way of doing it or not?
Another way to do what? Never mind I have lost interest.
led mike
|
|
|
|
|
|
You can just create a static property object, bind the properties (color, font, background) and use the system.configuration.Configuration to store/retrieve the values using the app.config file.
|
|
|
|
|
|
go away!!!!
|
|
|
|
|
Quit crop-dusting our forums with crap. Do the f***ing work yourself, you little lazy, stupid, rude Indian.
I'm going to become rich when I create a device that allows me to punch people in the face over the internet.
"If an Indian asked a programming question in the forest, would it still be urgent?" - John Simmons / outlaw programmer
|
|
|
|
|
Justin Perez wrote: Quit crop-dusting our forums with crap. Do the f***ing work yourself, you little lazy, stupid, rude
.. is fair enough, I completely agree! The fact that the guy is Indian is nothing to do with it though.
|
|
|
|