Short cut icons on a windows form
-
I am making a windows form and I would like to place buttons or icons that will start other applications from the form. I am programming this is c#. I would like to know what I need to do to get the button to start other programs .exe Thanks for any help
-
I am making a windows form and I would like to place buttons or icons that will start other applications from the form. I am programming this is c#. I would like to know what I need to do to get the button to start other programs .exe Thanks for any help
Use the
System.Diagnostics.Process newProcess = System.Diagnostics.Process.Start(exe, params)
method in the buttons OnClick handler. If you need more control over the appearance of the new application you shoud first fill a ProcessStartInfo and then call theSystem.Diagnostics.Process newProcess = System.Diagnostics.Process.Start(startupInfo)
. To wait for the process to finish use the following code:System.Diagnostics.Process newProcess = System.Diagnostics.Process.Start(@"c:\windows\notepad.exe"); System.Threading.WaitHandle processHandle = new System.Threading.AutoResetEvent(false); processHandle.Handle = newProcess.Handle; processHandle.WaitOne();
/cadi 24 hours is not enough -
Use the
System.Diagnostics.Process newProcess = System.Diagnostics.Process.Start(exe, params)
method in the buttons OnClick handler. If you need more control over the appearance of the new application you shoud first fill a ProcessStartInfo and then call theSystem.Diagnostics.Process newProcess = System.Diagnostics.Process.Start(startupInfo)
. To wait for the process to finish use the following code:System.Diagnostics.Process newProcess = System.Diagnostics.Process.Start(@"c:\windows\notepad.exe"); System.Threading.WaitHandle processHandle = new System.Threading.AutoResetEvent(false); processHandle.Handle = newProcess.Handle; processHandle.WaitOne();
/cadi 24 hours is not enough